c# - How to avoid a serious error in .NET CF 3.5 and CE 6 R3 -


when start sample program on device attached debugger serious error occurs.

this stripped down version of happens in our real application.

what found out is:

  • debugger must attached
  • memory must filled somehow (i think force garbage collection)
  • garbage (bitmap)objects must exist. other objects might lead same error
  • a form must shown (no difference if application.run() or showdialog used)

then when form visible , gc collects bitmaps serious error occurs.

i'm running windowsce 6 r3 .net compact framework 3.5.

static class program {      static void main() {         // fill memory - depends on device         var memory = new int[100000 * 150];          // settings priority higher raise error earlier.         // priority set normal exe won't freed correct.         // without line have reboot ce after every test run...         thread.currentthread.priority = threadpriority.highest;          // 80 random choosen. error occurs 30 bitmaps...         (int o = 1; o < 80; o++) {             // create bitmap , don't free manually.             // garbage collector take care of :)             var bitmap = new bitmap(100, 100);              // when dispose bitmap, works fine...             //bitmap.dispose();         }          // force gc run         system.diagnostics.debug.writeline(gc.gettotalmemory(true));          // error occurs when form shown.         system.windows.forms.application.run(new system.windows.forms.form());     } } 

i've found similar questions no anwser...

what i've tried far:

  • clean resources manually. i've searched bitmap creations , disposed or cached them. error still occurs, it's not bitmaps bad...

i have theory, , system swapping. if debugger tries retrieve content of variable who's own size exceeds ce's paging pool size, imagine deadlock. debugger stopped system read data, system can't provide content because can't swap in data. using ioctl_hal_get_pool_parameters, should able detect whether system swapping or not.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -