Main Site Documentation

G120 Runtime Error


#1

Hi I have problem, I have written my own Gui Framework, but there is a strange failure. After some time or intermediate the FEZ Cobra II freezes and reboots. Normaly the Debugger didn’t show any exception even he didn’t recognize the freeze.

But today I got following Error:

RUNTIME ERROR: comparing two values of different size: 1 vs. 7!!!

It was a ConstraintException.

What can cause this type of error? Hopefully someone can help me.

best regards


#2

Can you use try catch statement and see if you can catch the exception? Is it a lot of code? Can you show it here?


#3

Problems that occur after a while are often related to some resources that are not freed (memory for example).
You should run a manual GC once in a while and compare the output.
Also check your code for disposable objects not getting disposed (the using statement is wonderful for these objects) or if you allocate memory (Bitmaps eventually?) that get not freed.
Large bitmaps get allocated in the custom heap for example, which needs special treatment for freeing objects (check the docs section for custom heap).


#4

Yes its to much code, and the debbuger showed only once the exception but didn’t stopped or anything else.

I only use one Bitmap object and pass it threw to my controls. Can that cause the problem? May I should post the code on codeshare


#5

I would say don’t post “problem” code on codeshare. Post it on SkyDrive or bitbucket


#6

So know I added a Debug.GC(true) in my main loop, fired every minute.

I got following:

[quote]
Type 15 (FREEBLOCK ): 6767616 bytes
Type 16 (CACHEDBLOCK ): 288 bytes
Type 17 (ASSEMBLY ): 32220 bytes
Type 18 (WEAKCLASS ): 48 bytes
Type 19 (REFLECTION ): 48 bytes
Type 1B (DELEGATE_HEAD ): 2340 bytes
Type 1C (DELEGATELIST_HEAD ): 396 bytes
Type 1D (OBJECT_TO_EVENT ): 5736 bytes
Type 1E (BINARY_BLOB_HEAD ): 465684 bytes
Type 1F (THREAD ): 1920 bytes
Type 20 (SUBTHREAD ): 240 bytes
Type 21 (STACK_FRAME ): 912 bytes
Type 22 (TIMER_HEAD ): 360 bytes
Type 27 (FINALIZER_HEAD ): 5616 bytes
Type 28 (MEMORY_STREAM_HEAD ): 36 bytes
Type 29 (MEMORY_STREAM_DATA ): 396 bytes
Type 31 (IO_PORT ): 432 bytes
Type 33 (I2C_XACTION ): 10560 bytes
Type 34 (APPDOMAIN_HEAD ): 72 bytes
Type 36 (APPDOMAIN_ASSEMBLY ): 2976 bytes
GC: performing heap compaction…
Free memory: 6609kb
GC: 13msec 545868 bytes used, 6793800 bytes available
Type 0F (STRING ): 1524 bytes
Type 11 (CLASS ): 14184 bytes
Type 12 (VALUETYPE ): 648 bytes
Type 13 (SZARRAY ): 5580 bytes
Type 03 (U1 ): 648 bytes
Type 04 (CHAR ): 444 bytes
Type 07 (I4 ): 36 bytes
Type 0A (I8 ): 1656 bytes
Type 0F (STRING ): 24 bytes
Type 11 (CLASS ): 2688 bytes
Type 12 (VALUETYPE ): 84 bytes
Type 15 (FREEBLOCK ): 6793800 bytes
Type 16 (CACHEDBLOCK ): 15840 bytes
Type 17 (ASSEMBLY ): 32220 bytes
Type 18 (WEAKCLASS ): 48 bytes
Type 19 (REFLECTION ): 48 bytes
Type 1B (DELEGATE_HEAD ): 2052 bytes
Type 1C (DELEGATELIST_HEAD ): 300 bytes
Type 1D (OBJECT_TO_EVENT ): 456 bytes
Type 1E (BINARY_BLOB_HEAD ): 465288 bytes
Type 1F (THREAD ): 1920 bytes
Type 20 (SUBTHREAD ): 240 bytes
Type 21 (STACK_FRAME ): 912 bytes
Type 22 (TIMER_HEAD ): 360 bytes
Type 27 (FINALIZER_HEAD ): 336 bytes
Type 28 (MEMORY_STREAM_HEAD ): 36 bytes
Type 29 (MEMORY_STREAM_DATA ): 396 bytes
Type 31 (IO_PORT ): 432 bytes
Type 34 (APPDOMAIN_HEAD ): 72 bytes
Type 36 (APPDOMAIN_ASSEMBLY ): 2976 bytes
GC: performing heap compaction…
Free memory: 6634kb
GC: 7msec 530028 bytes used, 6809640 bytes available
Type 0F (STRING ): 1524 bytes
Type 11 (CLASS ): 14184 bytes
Type 12 (VALUETYPE ): 648 bytes
Type 13 (SZARRAY ): 5580 bytes
Type 03 (U1 ): 648 bytes
Type 04 (CHAR ): 444 bytes
Type 07 (I4 ): 36 bytes
Type 0A (I8 ): 1656 bytes
Type 0F (STRING ): 24 bytes
Type 11 (CLASS ): 2688 bytes
Type 12 (VALUETYPE ): 84 bytes
Type 18 (WEAKCLASS ): 48 bytes
Type 19 (REFLECTION ): 48 bytes
Type 1B (DELEGATE_HEAD ): 2052 bytes
Type 1C (DELEGATELIST_HEAD ): 300 bytes
Type 1D (OBJECT_TO_EVENT ): 456 bytes
Type 1E (BINARY_BLOB_HEAD ): 465288 bytes
Type 1F (THREAD ): 1920 bytes
Type 20 (SUBTHREAD ): 240 bytes
Type 21 (STACK_FRAME ): 912 bytes
Type 22 (TIMER_HEAD ): 360 bytes
Type 27 (FINALIZER_HEAD ): 336 bytes
Type 28 (MEMORY_STREAM_HEAD ): 36 bytes
Type 29 (MEMORY_STREAM_DATA ): 396 bytes
Type 31 (IO_PORT ): 432 bytes
Type 34 (APPDOMAIN_HEAD ): 72 bytes
Type 36 (APPDOMAIN_ASSEMBLY ): 2976 bytes
GC: performing heap compaction…
Free memory: 6650kb
LY ): 32220 bytes
GC: 28msec 630108 bytes used, 6709560 bytes available
Type 0F (STRING ): 1524 bytes
Type 11 (CLASS ): 60888 bytes
Type 12 (VALUETYPE ): 648 bytes
Type 13 (SZARRAY ): 5580 bytes
Type 03 (U1 ): 648 bytes
Type 04 (CHAR ): 444 bytes
Type 07 (I4 ): 36 bytes
Type 0A (I8 ): 1656 bytes
Type 0F (STRING ): 24 bytes
Type 11 (CLASS ): 2688 bytes
Type 12 (VALUETYPE ): 84 bytes
Type 15 (FREEBLOCK ): 6709560 bytes
Type 17 (ASSEMBLY ): 32220 bytes
Type 18 (WEAKCLASS ): 48 bytes
Type 19 (REFLECTION ): 48 bytes
Type 1B (DELEGATE_HEAD ): 2052 bytes
Type 1C (DELEGATELIST_HEAD ): 300 bytes
Type 1D (OBJECT_TO_EVENT ): 13800 bytes
Type 1E (BINARY_BLOB_HEAD ): 465288 bytes
Type 1F (THREAD ): 1920 bytes
Type 20 (SUBTHREAD ): 240 bytes
Type 21 (STACK_FRAME ): 912 bytes
Type 22 (TIMER_HEAD ): 360 bytes
Type 27 (FINALIZER_HEAD ): 13680 bytes
Type 28 (MEMORY_STREAM_HEAD ): 36 bytes
Type 29 (MEMORY_STREAM_DATA ): 396 bytes
Type 31 (IO_PORT ): 432 bytes
Type 33 (I2C_XACTION ): 26688 bytes
Type 34 (APPDOMAIN_HEAD ): 72 bytes
Type 36 (APPDOMAIN_ASSEMBLY ): 2976 bytes
GC: performing heap compaction…
Free memory: 6552kb
GC: 22msec 570060 bytes used, 6769608 bytes available
Type 0F (STRING ): 1524 bytes
Type 11 (CLASS ): 14184 bytes
Type 12 (VALUETYPE ): 648 bytes
Type 13 (SZARRAY ): 5580 bytes
Type 03 (U1 ): 648 bytes
Type 04 (CHAR ): 444 bytes
Type 07 (I4 ): 36 bytes
Type 0A (I8 ): 1656 bytes
Type 0F (STRING ): 24 bytes
Type 11 (CLASS ): 2688 bytes
Type 12 (VALUETYPE ): 84 bytes
Type 15 (FREEBLOCK ): 6769608 bytes
Type 16 (CACHEDBLOCK ): 40032 bytes
Type 17 (ASSEMBLY ): 32220 bytes
Type 18 (WEAKCLASS ): 48 bytes
Type 19 (REFLECTION ): 48 bytes
Type 1B (DELEGATE_HEAD ): 2052 bytes
Type 1C (DELEGATELIST_HEAD ): 300 bytes
Type 1D (OBJECT_TO_EVENT ): 456 bytes
Type 1E (BINARY_BLOB_HEAD ): 465288 bytes
Type 1F (THREAD ): 1920 bytes
Type 20 (SUBTHREAD ): 240 bytes
Type 21 (STACK_FRAME ): 912 bytes
Type 22 (TIMER_HEAD ): 360 bytes
Type 27 (FINALIZER_HEAD ): 336 bytes
Type 28 (MEMORY_STREAM_HEAD ): 36 bytes
Type 29 (MEMORY_STREAM_DATA ): 396 bytes
Type 31 (IO_PORT ): 432 bytes
Type 34 (APPDOMAIN_HEAD ): 72 bytes
Type 36 (APPDOMAIN_ASSEMBLY ): 2976 bytes
GC: performing heap compaction…
Free memory: 6610kb[/quote]

I realy tried to use the touch interface the hole time. It ended in an freeze. But the memory isn’t exploding. Can any body see’s something strange on the GC output?


#7

It’d help if you told us about your use case. The last mention of touch was the first time that came up. We’re all going to be shooting in the dark unless you tell us more about your entire system and what your symptoms are.


#8

So I have put it on codeplex, may someone has time and can tell me what I made wrong.

The problem is as follows. After a while of using it, my fez cobra II will freeze and restart after a while. No output on the debugger, nor it realize that the board freezes or restarts.

Edit: In the initialization of the CP7 touch, it will change the register ID_G_MODE = 0xA4 from 1 to 0, this means that the interrupt behavier of the touch controller gets changed. Now it only interrupts on Touch-Down and Touch-Up


#9

One possible reason for a freeze with restart after a short while is a recursive call without exit.
Means a method or property that calls itself (directly or indirectly).
By this the execution is stuck there and you get an stack overflow after a while (Might also result in an out of memory) which will trigger an reboot.

So you could check for pieces of code that gets called rarely and has an unwanted recursive call, or if any recursive call has an exit option that might not come true for any reason.


#10

@ Ostermeier

I have ckecked all, and nothing, the program I published on codeplex do unexpected reboots at undefined positions of the program. Maybe its related to your bug.

At the moment its really frustrating. I have checked it with windows 7 and 8. and with SDK R1 to R3. Mostly with the old versions its better.