Top: Programming: C / C++ : Garbage Collection in C#

A significant advantage of C  when compared to C   is the memory management capabilities of the C   The programmer need not worry about memory management  the garbage collector is assigned this operation on the programmer s behalf  You will probably know that value data types are stored on the stack while reference data types are stored on the managed heap  The stack stores data value types that are not members of objects  Also  in C  it is always the case that if variable a goes into scope before variable b  then b will go out of scope first  For example  if you declare some variables in a method  these variables will go out of scope when the method ends   However  it maybe sometimes that you need to keep these variables long after the method function ended  This happens for all data declared with the new operator  the reference types  All reference types are stored in the managed heap  which is under the control of garbage collector

Garbage Collection in C#

A significant advantage of C# when compared to C++ is the memory management capabilities of the C#. The programmer need not worry about memory management; the garbage collector is assigned this operation on the programmer’s behalf. You will probably know that value data types are stored on the stack while reference data types are stored on the managed heap. The stack stores data value types that are not members of objects. Also, in C# it is always the case that if variable a goes into scope before variable b, then b will go out of scope first. For example, if you declare some variables in a method, these variables will go out of scope when the method ends. However, it maybe sometimes that you need to keep these variables long after the method/function ended. This happens for all data declared with the new operator, the reference types. All reference types are stored in the managed heap, which is under the control of garbage collector.

ADVERTISMENT

Comments

No comments at this moment

» Hardware reviews

SOFTutorials

Highest Rated

Draw 3D lighting text in photoshop

3D Shining Text - Draw 3D lighting text in photoshop ...

Rated:**** with 795 hits

Draw nice fireworks with Tool Brushes and Blending options  Very easy but nice tutorial

Fireworks in Photoshop - Draw nice fireworks with Tool Brushes and Blending options. Very easy but n...

Rated:**** with 538 hits

Make 3D text inspired by 20th Century Fox logo

3D New Year Text in Photoshop - Make 3D text inspired by 20th Century Fox logo. ...

Rated:**** with 1114 hits

Draw Exploding Earth using tools and filters

Exploding planet in Photoshop - Draw Exploding Earth using tools and filters. ...

Rated:**** with 814 hits

Most Popular

Easiest way to improve Capture performance in Windows MovieMaker  Follow the tutorial

Improving capture performance in Windows Movie Maker - Easiest way to improve Capture performance in Windows MovieMaker. Follow th...

Rated:*** with 43744 hits

If you want very realistic render you need to use V ray Render plugin  In this tutorial I will show you how to create V ray glass material

V-ray Glass Material - If you want very realistic render you need to use V-ray Render plugin. In t...

Rated:**** with 42209 hits

This tutorial describes tasks that you do almost every time you run the program  It explains how to start PowerPoint and create  save  open  and close presentations

Getting Started with PowerPoint - This tutorial describes tasks that you do almost every time you run the pro...

Rated:**** with 40744 hits

Tutorial showing how to create and animate the raining code effect from the popular trilogy the Matrix  no plug ins necessary  step by step video tutorial streaming and direct download

The Matrix Raining Code Video Tutorial - Tutorial showing how to create and animate the raining code effect from the...

Rated:*** with 35365 hits