Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / April 2008

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DR - 15 Apr 2008 22:03 GMT
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() ?
Henning Krause [MVP - Exchange] - 15 Apr 2008 22:48 GMT
Hello,

in 99% of the time, you should not call GC.Collect. In many cases this will
actually decrease performance as you distort internal statistics of the GC.

Take a Profiler (SciTech Memory profiler is what I use when troubleshooting
memory problems; They actually have a 30 days trial; http://www.scitech.se/)
and examine where the root references of your objects are.

Kind regards,
Henning Krause

> GC.Collect() not cleaning memory, how to find out what references to lots
> of memory still exist?
[quoted text clipped - 6 lines]
> easy way to see what references that I forgot to set to null so that the
> memory cleas up on GC.Collect() ?
Barry Kelly - 16 Apr 2008 00:24 GMT
> GC.Collect() not cleaning memory, how to find out what references to lots of
> memory still exist?
[quoted text clipped - 6 lines]
> way to see what references that I forgot to set to null so that the memory
> cleas up on GC.Collect() ?

BTW, WinDbg combined with SOS can find your roots too, for free. Rico
Mariani did an interesting presentation and some blog posts about it:

http://www.google.com/search?q=rico+mariani+windbg+sos+root

Here's one post:

http://blogs.msdn.com/ricom/archive/2004/12/10/279612.aspx

-- Barry

Signature

http://barrkel.blogspot.com/

Peter Duniho - 16 Apr 2008 01:57 GMT
> [snip]

Please stop multi-posting.  You've only been told dozens of times already  
not to do that, and you refuse to stop it.

Why anyone answers your questions at all, given your unwillingness to  
cooperate and treat the newsgroups more respectfully, is beyond me.  Maybe  
they just aren't aware that you post these questions in multiple  
newsgroups, causing readers of each newsgroup to wind up answering the  
questions independently, wasting everyone's bandwidth and time.

Hopefully that will change.
Barry Kelly - 16 Apr 2008 05:40 GMT
> > [snip]
>
> Please stop multi-posting.  You've only been told dozens of times already  
> not to do that, and you refuse to stop it.

I didn't know he's been repeatedly doing that. PLONK etc...

-- Barry

Signature

http://barrkel.blogspot.com/


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.