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() ?

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

Scott
Tue Apr 15 18:32:18 CDT 2008

Calling GC.Collect is a bad idea is all but the most severe cases. In real
practice, you should not use it as it can actually impede your application's
performance.

Your best bet is to look carefully at the objects you are using and make
sure that, where appropriate, you call Dispose on them.

-Scott


"DR" <softwareengineer98037@yahoo.com> wrote in message
news:uOkNbC0nIHA.2292@TK2MSFTNGP03.phx.gbl...
> 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() ?
>



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

Cor
Tue Apr 15 22:31:59 CDT 2008

DR,

Why you call GC.Collect? It is the same practise as power down your computer
after your program is done and than start again.

The benefit is the same, because with letting memory unused is nothing wrong
as long as there is enough. It is better to clean it up at the right time by
instance as there is not enough memory anymore or the computer is in a kind
of idle state. And that is where Net is for.

So the parallel with power down your computer is no joke, it is exactly the
same.

Cor




"DR" <softwareengineer98037@yahoo.com> schreef in bericht
news:uOkNbC0nIHA.2292@TK2MSFTNGP03.phx.gbl...
> 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() ?
>


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

Miha
Sun Apr 20 03:57:45 CDT 2008

Hi,

The best way would be to use an allocation profiler (i.e. AQTime) - it is
the only reliable way to look for memory leaks.

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"DR" <softwareengineer98037@yahoo.com> wrote in message
news:uOkNbC0nIHA.2292@TK2MSFTNGP03.phx.gbl...
> 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() ?
>