This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Java in General and the fly likes Re: Storage of objects and values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Re: Storage of objects and values" Watch "Re: Storage of objects and values" New topic

Re: Storage of objects and values

veeramani velayutham

Joined: Dec 10, 2004
Posts: 11
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

Joined: Jan 29, 2003
Posts: 8791
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.

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Consider Paul's rocket mass heater.
subject: Re: Storage of objects and values