473,387 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

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
2 2421
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Mark D. Anderson | last post by:
About a month ago Richard Cornford did an interesting analysis of a memory leak in jscript (internet explorer) when there are "circular" references between DOM objects and (real) jscript objects:...
9
by: Rafael Charnovscki | last post by:
I can comprehend the basics of that subject (pointers, memory allocation, heap, stack etc), but I am interested to have references with more details. I have some C/C++ books and lots of URLs...
3
by: John Sun | last post by:
Dear Group Gurus, If I use a COM class in my C# code, will the memory used by COM object be garbage collected, or do I have to manually collect it. Thanks, John
9
by: Frank Rizzo | last post by:
I understand the basic premise: when the object is out of scope or has been set to null (given that there are no funky finalizers), executing GC.Collect will clean up your resources. So I have...
5
by: Mrinal Kamboj | last post by:
Hi , Any pointers when it's absolute necessary to use it . Does it has a blocking effect on the code , as GC per se is undeterministic . what if GC.collect is followed in next line by...
2
by: George Shui | last post by:
I use webBrowser to open a Word document, when I use this.webBrowser.dispose(), the WinWord Process end. while I use this.webBrowser = null, GC.Collect() , the WinWord Process still alive. I...
48
by: Ward Bekker | last post by:
Hi, I'm wondering if the GC.Collect method really collects all objects possible objects? Or is this still a "smart" process sometimes keeping objects alive even if they can be garbage collected?...
1
by: Henning Krause [MVP - Exchange] | last post by:
Hi, answered in public.dotnet.framework. Please do not multipost. Do a proper crosspost instead. Kind regards, Henning Krause "DR" <softwareengineer98037@yahoo.comwrote in message
0
by: DR | last post by:
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.