What is heap memory ?

Questions by kirankumar samudrala   answers by kirankumar samudrala

Showing Answers 1 - 9 of 9 Answers

Preetham R Enjamuri

  • Jan 17th, 2012
 

Memory allocated for a JVM Process where the application is deployed in order to load objects of the application into the memory.
Size depends on the objects of the application.

  Was this answer useful?  Yes

Ragapriya Sukumaran

  • Feb 21st, 2013
 

Heap memory is the memory allocated to JVM to store the Java objects used while running a program. Heap memory is logically divided into Eden, Old/Tenured and Permanent space wherein Eden holds the short live objects. Tenure holds the Long lived objects and Permanent space is to store the Java classes and classloaders.

The heap (also known as the free store?) is a large pool of memory used for dynamic allocation. The heap is a region of your computers memory that is not managed automatically for you, and is not as tightly managed by the CPU. It is a more free-floating region of memory. The heap segment provides more stable storage of data for a program; memory allocated in the heap remains in existence for the duration of a program.

Therefore, global variables (storage class external), and static variables are allocated on the heap. The memory allocated in the heap area, if initialized to zero at program start, remains zero until the program makes use of it. Once you have allocated memory on the heap, you are responsible for using free() to deallocate that memory once you dont need it any more. If you fail to do this, your program will have what is known as a memory leak.

Heap in Java generally located at bottom of address space and move upwards. whenever we create object using new operator or by any another means object is allocated memory from Heap and When object dies or garbage collected ,memory goes back to Heap space in Java.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions