The Manhattan Project

The Manhattan Project was a research and development undertaking during World War II that produced the first nuclear weapons. It was led by the United States with the support of the United Kingdom…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




What is Garbage Collection ? How it Works ?

Garbage collection is know as automation storage reclamation (i.e) it is the process of releasing the memory used by the objects, which are no longer referenced. This is done in different ways and different manners in various platforms and languages.

So when a program starts, the system allocates the memory for that to execute. There are two different place where the CLR stores the objects STACK and HEAP.

Inside the GC, the memory is separated into three parts,

So What happens when a new object is created ?

These all will always happen in the Generation 0.

So What happens if the object doesn’t fit into the Generation 0, then the GC comes into picture.

Now the Generation 0 is fully available for allocating the objects. The same happens for the Generation 1 while moving the objects from the Generation 0 if the Generation 1 is full, the Generation 1 items will be moved to Generation 2.

What happens when all the Generations are full ? Yes, It throws the MemoryOutofRangeException.

GC will be invoked automatically, If you need to invoke the collect method manually call GC.Collect(). Please do refer the below links for further more details.

Add a comment

Related posts:

Matriarch

Matriarch. I listen as Her mind cracks And disappears into the wind. Losing her independence To age — Eighty-two years young, Fading in the Arms of….

Lessons from Jamming with the Band

Receiving feedback and acting on it is an important life skill. Read on about the story of one band and how they did it… So recently we were to perform at a show and at the pre-concert review a week…

The 10 Best Comic Book Character Rivalries

These contentions characterized a medium and an industry. Practically all famous appearances in the domain of superheroes can be followed back to the smart pages of comic books. What’s more, similar…