Hi All, Can anyone please give me a good link for a topic on memory allcoations in java as to, *)where are all the static objects of a class stored *)where are the methods stored during exection,I mean which part of memory. *)are members of a Ojects or instance methods and class methods or static methods stored on the same memory location during their execution? *)where are primitive types stored which are delcared as attribute of the class.
So for Ex,
where is the temp1,temp2,temp3 stored where is int a stored where is int b stored where is int c stored and whre are both of the methods of the above class stored while execution
Thanks All,Appreciate your valuable Time. [ September 18, 2006: Message edited by: Archies Gomes ]
Rusty Shackleford
Ranch Hand
Joined: Jan 03, 2006
Posts: 490
posted
0
Objects are stored on the heap.
When methods are called they are moved to the stack for processing.
"Computer science is no more about computers than astronomy is about telescopes" - Edsger Dijkstra
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12271
1
posted
0
When methods are called they are moved to the stack for processing.
If methods didn't go on the stack, recursion would be impossible.
Pratibha Malhotra
Ranch Hand
Joined: Dec 21, 2003
Posts: 199
posted
0
Instance variables and Objects are stored in HEAP AREA and become a candidate for garbage collection after going out of scope.
Local var(whether static or not), methods reside on stack and are never Garbage collected. Its just that stack is reused once method execution is completed.
HTH,
~ Pratibha Malhotra<br /> <br />Sun Certified Java Programmer<br />SCEA 1.4 (In Progress)<br />~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />"Many of life's failures are people who did not realize how close they were to success when they gave up!!"
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12271
1
posted
0
When you say
When methods are called they are moved to the stack for processing.
what do you think that means?? It sounded to me like an implication that method byte code is moved when a call is executed. Bill