Important information on how .NET garbage collector works and how to analyze memory.Memory for all objects are allocated in the managed heap. "Managed" here means that all objects that are not longer used by the application are automatically destroyed. The following happens on creating a new object: 1. Size of the object is added to the recorded pointer for new object and if there is not enough memory for allocation, collect garbage and calculate pointer for new object.
2. Memory for object is allocated and cleared, starting from recorder pointer for new object.
3. The pointer for new object is increased on the allocated size.In reality, a collection occurs when generation 0 is completely full. [1] There are three generations of the objects: * Zero generation: newly created objects.
* First generation: objects that survive CG.Collect().
* Second generation: objects that survive CG.Collect() multiple times. Garbage collection for specific generation happens in one of these situations: * There is no memory in a heap (threshold reached) for new objects of this generation and size.
* CG.Collect() is called with corresponding parameter.
* System in low memory situation.Read more: Alex@Net
2. Memory for object is allocated and cleared, starting from recorder pointer for new object.
3. The pointer for new object is increased on the allocated size.In reality, a collection occurs when generation 0 is completely full. [1] There are three generations of the objects: * Zero generation: newly created objects.
* First generation: objects that survive CG.Collect().
* Second generation: objects that survive CG.Collect() multiple times. Garbage collection for specific generation happens in one of these situations: * There is no memory in a heap (threshold reached) for new objects of this generation and size.
* CG.Collect() is called with corresponding parameter.
* System in low memory situation.Read more: Alex@Net