I'm a big fan of the .Net Compact Framework. It's fast. It's versatile. And you have easy access to native API via P/Invoke when the framework is lacking something you need. Despite my overwhelming enthusiasm for the Compact Framework, I am concerned that it may have a memory leak and I have never seen anybody officially discuss it, provide a reasonable workaround, or find a way to confirm the existence of the leak (other than my circumstantial evidence outlined below).
Let me explain my experience. I have used three Windows Mobile devices that have the 3.5 Framework and have several applications that make heavy use of Image objects (such as Bitmap, etc.). After time, they will all eventually run into an Out Of Memory (OOM) exception, as long as I let them run long enough (anywhere from 8 hours to a few days).
In the development community, you will see authors explicitly releasing bug fixes that work around OOM exceptions by ignoring them.
I believe this might be a situation where the framework is either failing to properly dispose of allocated memory when the garbage collector is run after an object is no longer being referenced, or is not disposing of the objects in a timely manner (i.e., the object is not disposed of until much later after the object is set to NULL, its last reference is destroyed, or explicitly has its .Dispose() method called).
My one piece of evidence (other than apps that seem to "degrade" over time), is that gwes.exe will tend to increase its memory consumption the longer a graphics heavy .Net app runs up until this problem occurs. Then when the .Net app is terminated, it will decrease considerably.
As an aside, there is plenty of RAM available on the devices I have tested, so the OOM exception is likely due to heap space or window handles running out, not total RAM.
Anybody else have any clues? It may not be a bug, but the fact that it seems to span over multiple .Net applications is what is leading my nose in that direction. Is it maybe as simple as manually calling .Dispose() instead of leaving the clean-up to the garbage collector?