OutOfMemeoryException

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

Guest

I have a Pocket PC app that is coming up with a outofmemory exception.
Bacially it loads a big document and everything is enclosed in a big object
that gets mouse events and paint events from a panel. I also use one global
form and reuse this all the time to display a set of forms all defined in the
big document. There is no unmanaged code, no multithreading, and it is all
pretty basic .NET stuff.

When I set the big object to nothing (getting rid of all the references and
event hook ups), and dispose of the form (because they normally hold some odd
references to things) and run a GC.Collect(), I expected the GC to be able to
collect everything. My understanding from hours reading about the GC is that
it collects everything that hasnt got a reference from the roots.

Why therefore do I lose about 1Mb each time I open and close one of these
big documents. I guess thats too hard - lets rephrase.
Do I need to 'manually' dispose of everything with a dispose option?
Is there something better than ce remote heap walker (whichy doesnt work
here probably because it is too big) for debugging?
Is dumping a whole set of stuff acceptable practice, seams very neat to me?
Could the Form somehow retain a reference to some of the controls that are
since moved from it, even after disposal?

I'll be notified of your gratefully recieved replies.
 
Ore you running CF 1.0 RTM or a service pack? In your OnPaint override, do
you Dispose your GDI objects?

-Chris
 
Since my last post,I have set up a whole chain of disposes, to get rid of
some controls that I create and this atleaast on intial inspection seams aid
in the release. I would still like a clear description of when dispose is and
isnt required. Some articles suggest dont bother, some suggest always use
when available. Confusing
 
As a general rule, if a class explicitly implements Dispose, you should call
it.

--
Chris Tacke
Co-founder
OpenNETCF.org
Are you using the SDF? Let's do a case study.
Email us at d c s @ o p e n n e t c f . c o m
http://www.opennetcf.org/donate
 
Back
Top