Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Heap and Stack  RSS feed

 
Girish Prabhudesai
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anybody tell me difference in memory stack and heap being used in Java JVM?
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Basically, the stack is where local variables are kept -- ints, floats, doubles, and references to objects -- while the heap is where objects themselves are allocated. So variables on the stack can point to objects on the heap.
Does this answer your question?
 
Girish Prabhudesai
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the answer.
 
VIJAY Yadlapati
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All Objects are stored on Heap.
All variables and address of object inHeap are stored in Stack.
 
VIJAY Yadlapati
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All Objects are stored on Heap.
all variables and addresses of objects are stored on Stack.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!