Re: Question on Garbage Collection
From: Scott M. (NoSpam_at_NoSpam.com)
Date: 10/20/04
- Next message: Prasanna Padmanabhan: "Re: Question on Garbage Collection"
- Previous message: Prasanna Padmanabhan: "Question on Garbage Collection"
- In reply to: Prasanna Padmanabhan: "Question on Garbage Collection"
- Next in thread: Prasanna Padmanabhan: "Re: Question on Garbage Collection"
- Reply: Prasanna Padmanabhan: "Re: Question on Garbage Collection"
- Messages sorted by: [ date ] [ thread ]
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
>
>
>
- Next message: Prasanna Padmanabhan: "Re: Question on Garbage Collection"
- Previous message: Prasanna Padmanabhan: "Question on Garbage Collection"
- In reply to: Prasanna Padmanabhan: "Question on Garbage Collection"
- Next in thread: Prasanna Padmanabhan: "Re: Question on Garbage Collection"
- Reply: Prasanna Padmanabhan: "Re: Question on Garbage Collection"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|