Re: Question on Garbage Collection

From: Scott M. (NoSpam_at_NoSpam.com)
Date: 10/20/04


Date: Tue, 19 Oct 2004 20:25:31 -0500

The GC runs according to its collecting algorithm. There is no way to know
for sure when (if) it will run unless you were to call it manually
(GC.Collect) - - which, in most circumstances, you shouldn't do.

The GC runs in its own thread normally, but if you call it explicitly from
your code, it will run in the same thread as your code does (which could
actually slow your app down).

VS.NET 2003 is actually not a .NET application, and as such, is not governed
by the CLR (or Garbage Collection).

"Prasanna Padmanabhan" <prasannap@citrix.nospam.com> wrote in message
news:OwLfGPjtEHA.3320@TK2MSFTNGP15.phx.gbl...
> In a simple .NET application, I create a Hashtable that add 1000 entries
> to
> it.
> In Task Manager, the memory usage for the .NET process spikes up
> (understandably).
>
> I now remove all the 1000 entries from the Hashtable. The memory usage
> does
> not
> go down. I understand this also. This is because the GC has not run yet.
>
> But my question is, when does GC run again? I did notice that when I start
> a
> heavyweight
> app like VS 2003, the memory usage of my original app went down!
>
> So it is as if GC ran at that point, collected and compacted all the
> unused
> garbage memory
> and gave it back to the system. Right?
>
> Also, is the GC a thread? If so, in whose process space does it run? Is is
> per .NET process
> or just one unique GC thread for the entire system?
>
> Prasanna
>
>
>



Relevant Pages

  • Re: Run garbage collection
    ... GC does run when the memory usage gets near 90%, but I would rather it be part of the image processing, that is process the image and right away ... I know I can request that the JVM run GC overall, but can this be done on a particular object? ... consequences of collecting an object that did in fact have a ... To verify that an object is truly garbage (or that it is not ...
    (comp.lang.java.help)
  • Re: PdhCollectQueryData wont collect data on WXP after SP2 - Solved
    ... when my server app starts, and so it fails to connect to or supply data to ... >I am running Windows XP Home and have a server application that is started ... > On XP with SP1 this ran fine, collecting data and logging it. ... > application, and then run the server app, the data is collected normally. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: System Process (PID 8) creates mail
    ... But keep in mind that finding the app that was generating the outbound ... SMTP does not mean you have found what might be present ... collecting what was being emailed. ... I used kill to stop this app, deleted it, then rebooted. ...
    (microsoft.public.win2000.security)
  • Re: System.Diagnostics.Process causig memory leak
    ... Ehhm yes your right GC is collecting, ... I ran 2 days the app looking at it right now being stable at 14 mb. ... Regards ...
    (microsoft.public.dotnet.languages.csharp)