Java Heap Memory vs Stack Memory Difference
Java Heap Memory vs Stack Memory Difference Pankaj August 18, 2014 Interview Questions , Java Sometime back I wrote a couple of posts about Java Garbage Collection and Java is Pass by Value , after that I got a lot of emails to explain about Java Heap Memory, Java Stack Memory and what are the differences between them. You will see a lot of reference to Heap and Stack memory in Java, Java EE books and tutorials but hardly complete explanation of what is heap and stack memory in terms of a program. Java Heap Memory Heap memory is used by java runtime to allocate memory to Objects and JRE classes. Whenever we create any object, it's always created in the Heap space. Garbage Collection runs on the heap memory to free the memory used by objects that doesn't have any reference. Any object created in the heap space has global access and can be referenced from anywhere of the application. Java Stack Memory Java Stack memory is used for execution of a thread.Read full article from Java Heap Memory vs Stack Memory Difference
No comments:
Post a Comment