From the same post . . . . . .
# re: When to call GC.Collect()
Monday, November 29, 2004 4:02 PM by Darren Oakey
hmm.... I would disagree...
how about rule1: use GC.collect often and with a vengeance! :)
In my experience, the .net GC is a piece of **** and shouldn't be trusted.
We have found a number of production bugs that have been solved by a single
introduction of GC.Collect.
try it - make any batch routine that say - traverses your disk, opens each
file and computes a checksum, and run it with task manager open - it's quite
an eye-opener. The memory just goes up... and up... and up...
Now, insert the lines GC.Collect(), GC.WaitForPendi ngFinalizers() after
processing each file. Your job will run _quicker_, because the system isn't
continuously allocating memory, and the memory usage of your program will
remain constant.
I would say
rule 1: Use GC.Collect at the end of any major "operation" , or any form
finishing
rule 2: In any loop situation, always follow it with
GC.WaitForPendi ngFinalizers
rule 3: explicitly dispose anything that it's possible to dispose - to a
large extent, pretend the GC doesn't exist, and you are in an old language.
"Jon" <jo*******@nusy stems.com.au> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
GC only fress memory if there are other apps which needs more memory. If
there is enough free space it will not free memory.
http://blogs.msdn.com/ricom/archive/...29/271829.aspx
"Mr Newbie" <he**@now.com > wrote in message
news:uC******** ******@TK2MSFTN GP14.phx.gbl... You can force a collection with the GC.Collect() Method. But you should
not need this most of the time.
"Jon" <jo*******@nusy stems.com.au> wrote in message
news:uk******** ******@TK2MSFTN GP12.phx.gbl... This is normal behaviour, unless it is causing you a problem.
.Net usually grows and grows until garbage collection comes and cleans
it up.
"EDom" <te*******@peop lewareindia.com > wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Hi,
I have aspnet_wp.exe with increasing on every postback and not every
revisit
to any page. Even if I clear session and close the browser it remains
in the
memory. I have only one connection object and it is closed always as I
have
it under try catch, and all my variables are disposed at the end of
each
function. What could be the issue??
Regards,
Vineet