Shailendra Saxena's Technical Blog

Generations in Garbage Collections

clock January 30, 2013 07:43 by author ShailendraSaxena


The heap is organized into generations so it can handle long-lived and short-lived objects. Garbage collection primarily occurs with the reclamation of short-lived objects that typically occupy only a small part of the heap. There are three generations of objects on the heap:

·         Generation 0. This is the youngest generation and contains short-lived objects. An example of a short-lived object is a temporary variable. Garbage collection occurs most frequently in this generation.

Newly allocated objects form a new generation of objects and are implicitly generation 0 collections, unless they are large objects, in which case they go on the large object heap in a generation 2 collections.

Most objects are reclaimed for garbage collection in generation 0 and do not survive to the next generation.

·         Generation 1. This generation contains short-lived objects and serves as a buffer between short-lived objects and long-lived objects.

·         Generation 2. This generation contains long-lived objects. An example of a long-lived object is an object in a server application that contains static data that is live for the duration of the process.

Garbage collections occur on specific generations as conditions warrant. Collecting a generation means collecting objects in that generation and all its younger generations. A generation 2 garbage collection is also known as a full garbage collection, because it reclaims all objects in all generations (that is, all objects in the managed heap).

Useful Links

clock January 30, 2013 07:08 by author ShailendraSaxena
Useful Links
C# Programming Guide
Extension Methods
Lambda Expressions

' ' is not declared. It may be inaccessible due to its protection level.

clock January 25, 2013 04:55 by author ShailendraSaxena




I receive the error ‘ ’ is not declared. It may be inaccessible due to its protection level.While building the solution.


I changed the from ".NET Framework 3.5" to ".NET Framework 4" as below.



Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.

clock January 25, 2013 04:52 by author ShailendraSaxena


BackGround :

I had an application which was using .net framework version 2.0 then I added some dll of version 4.o then all of sudden when running the application I got the above error.



I add the below code in my all app.config of projects of my solution.







<<  August 2017  >>






Flag Counter


The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2017

Sign In