Click Here for 3 Month Free of ASP.NET Hosting!
Home | Submit an interview question | Filter by category | Filter by job function | Filter by company
 
Member Information
User Id
Password
 
Forgot Password
Technology Category
.NET (1202)
Languages (103)
Database (146)
Operating System (48)
Reporting (5)
Third-Party Tools (2)
Testing (91)
OOP (75)
Web Development (40)
Design Patterns (89)
General (9)
Networking (88)
Hardware (63)
Brain Exercise (2)
Others (37)
 Our Network
.NET Heaven
C# Corner
Interview Corner
Longhorn Corner
Mindcracker
VB.NET Heaven
Home » Languages » Languages
what is the concept of heap in memory management in c#?
Posted by asma farrukh Aug 22, 2009
Viewed : 364 times
Major Category : Languages
Minor Category : C-Sharp
Total Replies : 1
Become a Sponsor
 EDITORIAL ANSWER  
No Reply Yet
 ANSWERS BY USERS  
Suresh Ravi
Aug 31, 2009

The stack is the section of memory that is allocated for variables within functions.

Data is stored in stack using the Last In First Out (LIFO) method. This means that storage in the memory is allocated and de allocated at only one end of the memory called the top of the stack. Stack is a section of memory and its associated registers that is used for temporary storage of information in which the most recently stored item is the first to be retrieved.

The heap is an area of memory used for dynamic memory allocation. Blocks of memory are allocated and freed in this case in an arbitrary order. The pattern of allocation and size of blocks is not known until run time.

What we need to know here?
The reference types will go the heap memory
The value type will go the heap or stack based on where it is declared.

Example:

Class MyClass
{
int x;
Public int mymethod()
{
   Int y;
}
}

Here, both x & y are value types but  x will go to heap and y will go to stack.

 

  
1

 

 Hosted by MaximumASP  |  Found a broken link?  |  Contact Us  |  Terms & conditions  |  Privacy Policy  |  Advertise with us
Current Version: 2.2009.3.2
 © 1999 - 2009  Mindcracker LLC. All Rights Reserved