Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Re: Storage of objects and values

 
veeramani velayutham
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how objects and values are stored in java. i.e heap or stack.

can anyone explain the process how its stored.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In general, member variables are on the heap, parameters and local variables in a method are on the stack. I almost never think about heap and stack (unless I do recursion wrong and blow up the stack.) I do think about scope ... does this information need to live beyond the method?

I recently read some quotes from one of the creators of Simula, a direct precursor to object oriented thinking. They just moved some data from the stack to the heap. They didn't think it was any big revolution, just a convenient place to store stuff they'd need again later.

Here's the first in a neat series getting Under The Hood of the JVM. It's a nice introduction to all kinds of JVM internals, even if it's a couple releases old now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic