GC.Collect() not cleaning memory, how to find out what references to lots of memory still exist?

  • Thread starter Thread starter DR
  • Start date Start date
D

DR

GC.Collect() not cleaning memory, how to find out what references to lots of
memory still exist?

When all my processign is done i set everything to null and then:
GC.Collect();
and then
GC.WaitForPendingFinalizers();
but it still shows that my process takes 400 MB of memory. Is there any easy
way to see what references that I forgot to set to null so that the memory
cleas up on GC.Collect() ?
 
If you're running CF 3.5 you can use the profiler, which is part of the
Remote Performance Monitor.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com
 
If you are using CF 2 like I do, you can retarget your application to
run on the full framework and then use the Profiler for the full
framework.

Besides, I think that setting all the references to null is not
enough... you should call Dispose() where it is requiered (i.e.
Bitmaps).
 
It is always bad design to call the garbage collector to explicitly clean up.
 
I wouldn't go that far. "Always" is too strong a statement. It is rarely
good design, but not *always* bad.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top