Posts Tagged ‘Memory Management’

Stack, Heap and C# Datatypes

February 6, 2011 Leave a comment

Memory Management

It is extremely important to know how Memory works in C#. Firstly you need to know there are different types of memory in each programming language including C#. Two of those are Stack and Heap.

The stack is a place in the computer memory where all the variables that are declared and initialized before runtime are stored. The heap is the section of computer memory where all the variables created or initialized at runtime are stored.

The distinction between stack and heap relates to programming. When you look at your computer memory, it is organized into three segments:

  1. Code Segment.
  2. Stack.
  3. Heap.

What is the Code Segment?

The code segment also known as the Text Segment is where the compiled program (.exe) of the code itself is stored. For example when you open a .exe application up in notepad you will see text that is not readable, just a whole lot of mixed up text. This is the machine code.


Read more…

Categories: Architecture Tags:
%d bloggers like this: