File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Stack memory and Heap memory in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Stack memory and Heap memory in java" Watch "Stack memory and Heap memory in java" New topic

Stack memory and Heap memory in java

Ramesh Pappala
Ranch Hand

Joined: Sep 14, 2005
Posts: 50
I need complete details about Stack memory and Heap memory in Java.
That means how the instance variables or the objects are going to placed in those memories and all that.
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24195

Read this long discussion of exactly this topic. If you read all this and still don't understand, then reply with followup questions.

[Jess in Action][AskingGoodQuestions]
Rick O'Shay
Ranch Hand

Joined: Sep 19, 2004
Posts: 531
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1873

I draw this diagram while back..about this memory allocation in JVM process..

This might give you more idea. Only thing is the Java Stack box in the diagram attached with the Java thread might be confusing as I have them attached. What I actually wanted to convey there was -- each java thread has its own stack..

I agree. Here's the link:
subject: Stack memory and Heap memory in java
It's not a secret anymore!