Garbage Collection in C# | .NET Framework

Garbage Collection in .NET makes possible automatic memory management. Memory space appears when a class object appears. After completing all the object’s actions, the memory space allocated to the object is a waste. It is the reason why Garbage Collection is useful. It releases the memory space when it is not required. Garbage Collection has internally an engine named Optimization engine.

When does GC work?

Garbage Collection, when at least one of the following conditions is satisfied.

  • When the memory required for a particular project exceeds the available memory
  • When the system has low physical memory
  • When the developer calls the GC method, it happens only in special conditions because GC runs automatically.

Garbage Collection Example

The heap memory organized into three generations allows handling various objects during Garbage Collection.

  • Generation 0: all the objects such as temporary variables contained in generation 0. Generation 0 contains all short-lived objects.
  • Generation 1: the objects from generation 0, not released in the garbage collection, run, pass to generation 1. Generation 1 is a buffer between short-lived objects in generation 0 and the long-lived objects in generation 2.
  • Generation 2: the space occupied by the object in generation 1, not released in the garbage collection run; the objects pass to generation 2. There are static objects, and they remain in the heap memory during the process duration.

MS framework system has the Garbage Collection class. Here is the MaxGeneration.


using system;

class GCExample1 

    public static void Main(string[] args) 




            Console.WriteLine(“GC Maximum Generations:” + GC.MaxGeneration); 


        catch (Exception oEx) 


            Console.WriteLine(“Error:” + oEx.Message); 



MaxGeneration Property returns the highest generation in the GC. It is the total number of generations in the Garbage Collection beginning from 0. If it returns 2, that means three generations in the GC. These are Generation 0, Generation 1, and Generation 2.


It shows the memory occupied by various resources. I added a managed code object in the heap memory to increase the memory size. The GetGeneration method finds the managed object in which generation:
Total Memory: 141744
BaseGC Generation is: 0
Total memory: 149936

CollectionCount and Collect

CollectionCount helps to find the generation garbage collection that occurred. There are three generations in the GC. Initially, the argument was 0. Through the code, we collected the unused objects in generation 0. We checked the CollectionCount in generation 0. Is says 1. The Collect method collects unreferenced objects in the heap memory. It clears the object and reclaims the memory space.
Applications for editing documents using your smartphone

Applications for editing documents

Applications for editing documents using your smartphone benefit from most functions in Office Word, Excel, or PowerPoint and offer important facilities for those who need mobility. For Android, the most common office applications are:

  • OfficeSuite 8 + PDF Converter;
  • Polaris Office + PDF;
  • Microsoft Office Mobile;
  • WPS Office.

For iOS, the most common office applications for editing documents are:

  • Quickoffice Pro HD;
  • Pages, Numbers, Keynote;
  • Polaris Office.
Continue reading

Edit photos with the best programs online for free

Edit photos online, for free, and you will see why a picture is worth a thousand words. Or as many as hundreds of likes and comments from those you know (or not). Edit photos online is easier than ever. You want to have a surprising content on your social media pages, which you like and define your personality. And to get there, you know you have to post amazing photos frequently. But how do you get to the perfect picture? How do you retouch the few elements that should not have appeared in the frame? Simple! With a photo-editing application!  And as the market abounds with such applications, find out below which are the best photo editing applications! Often there is a need to edit photos online quickly, without installing bulky programs on your computer, applicationcomposite programs with lots of settings and often plywood. Fortunately, at the moment, there are a lot of possibilities to edit images online from the browser that can fully match your needs. And below I present the best programs to edit photos online for free, some online image editing applications directly from the browser.
Adobe Photoshop Express

With this application (which is, in fact, the mobile version of Photoshop that we all know), you can create collages from pictures, or you can add frames to photos. Edit photos with the best programs online for free. A plus is that you can share the image on social media channels directly from the application.

Photoshop Express offers a full range of free photo effects and convenient editing features. Customize your border and text experiences, enhance colors and images, create image collages, make quick corrections, and enhance your sharing moments.

Continue reading