Out of Memory Exeption - while still having free Memory

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi Folks,

I am trying to write a Windows-CE application under Visual Basic.NET
[2003]. This application should run 24 h a day and despite some minor
errors in vb.NET there is one big problem left:

I have a form for IO-Testing of my Serial Output, which contains a lot
of controls and some calculating. As far, there is nothing wrong, but if
this form runs several hours, the application crashes spontaneously
with an OutOfMemoryExeption - although nearly half of my memory is
unused. Meanwhile I am really convinved, that this one is not a memory
leak in my form or communication class, because the program´s allocated
Memory is nearly const and at some speacial point it just crashes,
without any obvious reason.

So is it possible that there is an error in the memory handling of the
microsoft compact framework? And more important, are there any fixes?

Regards, Peter
 
Peter,

the first thing that you should do is to install the CF SP2. I've
noticed that it really helped me with this issue (but not completely).
Another my suggestion is to implement something like WatchDog
application which will be watching for crashes of your application and
restart it (or maybe device).
 
Some tips/links to help you diagnose your memory problems follow:

Make sure you have the latest version isntalled SP2 or SP3 (for CE devices
only via QFE):
http://wiki.opennetcf.org/ow.asp?CompactFrameworkFAQ/DeterminingVersion

Everything you want to know about CF GC is here:
http://blogs.msdn.com/stevenpr/archive/2004/07/26/197254.aspx

Performance Counters are good for getting numbers between different GCs.They
have been described in a thread on this group and in an article on MSDN.
Both links are available from this post (that also lists the new counters
available in CF 2.0)
http://www.danielmoth.com/Blog/2004/08/performance-statistics-for-netcf-apps.html

To measure memory look at pinvoking GlobalMemoryStatus
http://msdn.microsoft.com/smartclient/understanding/netcf/FAQ/default...

Also check out GC.GetTotalMemory
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpre...

Cheers
Daniel
 
....and if you do go down the watchdog route there is some info here ;-)
http://www.danielmoth.com/Blog/2004/12/watchdog-design-for-cf-app.html

Cheers
Daniel
--
http://www.danielmoth.com/Blog/


Sergey Bogdanov said:
Peter,

the first thing that you should do is to install the CF SP2. I've noticed
that it really helped me with this issue (but not completely).
Another my suggestion is to implement something like WatchDog application
which will be watching for crashes of your application and restart it (or
maybe device).

offermann said:
I am trying to write a Windows-CE application under Visual Basic.NET
[2003]. This application should run 24 h a day and despite some minor
errors in vb.NET there is one big problem left:

I have a form for IO-Testing of my Serial Output, which contains a lot
of controls and some calculating. As far, there is nothing wrong, but if
this form runs several hours, the application crashes spontaneously
with an OutOfMemoryExeption - although nearly half of my memory is
unused. Meanwhile I am really convinved, that this one is not a memory
leak in my form or communication class, because the program´s allocated
Memory is nearly const and at some speacial point it just crashes,
without any obvious reason.

So is it possible that there is an error in the memory handling of the
microsoft compact framework? And more important, are there any fixes?

Regards, Peter
 
Back
Top