On Mon, 27 Jan 2003 15:28:44 -0800, Scott Burrington <[EMAIL PROTECTED]> wrote:
<snip> >However, I read that the >garbage collector does not activate until more memory is needed from the >heap. <snip> It is a common misconception that the GC only fires when all memory on the heap has been used. The GC fires way sooner though. Logically, the GC divides the heap in what are called generations. All newly created objects are put in generation 0. When the memory for generation 0 has been used up, only this generation is collected, and the objects that could not be collected are moved to generation 1. This goes on until generation 1 is full as well. At that time, both generation 0 and 1 are collected, and again the remaining objects are moved up to the next generation. There are only 3 generations (0, 1 and 2), so objects in generation 2 remain there until they're collected. For more info about the GC see [1]. This is just one of many optimisations. In general, Microsoft has put a great deal of effort in making the GC as affective as possible. (their goal was that a collection should not take any longer than a page fault) Geert [1] http://www.reikan.force9.co.uk/content/dotnet/general/gc.html You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.
