By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,180 Members | 1,012 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,180 IT Pros & Developers. It's quick & easy.

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

P: n/a
On 2008-04-15, DR <so*******************@yahoo.comwrote:
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() ?

Where are you seeing that? In the task manager? If so, then you are
looking in the wrong place. Let me tell you a little something about
windows memory management - just because memory is freed, does not mean
that the OS instantly removes it from your process.

You need to be looking at the performance counters for this - to find
out the actuall amount of memory your using....

--
Tom Shelton
Jun 27 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Apr 16, 1:08*am, Tom Shelton
<tom_shel...@YOUKNOWTHEDRILLcomcast.netwrote:
On 2008-04-15, DR <softwareengineer98...@yahoo.comwrote:
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() ?

Where are you seeing that? *In the task manager? *If so, then you are
looking in the wrong place. *Let me tell you a little something about
windows memory management - just because memory is freed, does not mean
that the OS instantly removes it from your process.

You need to be looking at the performance counters for this - to find
out the actuall amount of memory your using....

--
Tom Shelton
Hi,
Recently, i downloaded a small GDI+ article about graphics, then first
ran without looking source code, then what's that! My more than 500MB
free memory was about to become out. Then i found out that the problem
was using GC.SuppressFinalize before GC.Collect, removing
GC.SuppressFinalize and lines about finalizing which solved the
problem and GC.Collect was working good after this removal.

Maybe that would be your problem,

Hope this helps,

Onur Guzel
Jun 27 '08 #2

P: n/a
As I replied in another NG. GC.Collect should only be used in the most
memory intensive applicaitons. In practice, its use is not recommended.

-Scott

"kimiraikkonen" <ki*************@gmail.comwrote in message
news:bb**********************************@24g2000h sh.googlegroups.com...
On Apr 16, 1:08 am, Tom Shelton
<tom_shel...@YOUKNOWTHEDRILLcomcast.netwrote:
On 2008-04-15, DR <softwareengineer98...@yahoo.comwrote:
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() ?

Where are you seeing that? In the task manager? If so, then you are
looking in the wrong place. Let me tell you a little something about
windows memory management - just because memory is freed, does not mean
that the OS instantly removes it from your process.

You need to be looking at the performance counters for this - to find
out the actuall amount of memory your using....

--
Tom Shelton
Hi,
Recently, i downloaded a small GDI+ article about graphics, then first
ran without looking source code, then what's that! My more than 500MB
free memory was about to become out. Then i found out that the problem
was using GC.SuppressFinalize before GC.Collect, removing
GC.SuppressFinalize and lines about finalizing which solved the
problem and GC.Collect was working good after this removal.

Maybe that would be your problem,

Hope this helps,

Onur Guzel
Jun 27 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.