How does java allocate heap and stack memory?, JAVA Programming

Each time an object is started in Java it goes into the area of memory named as heap. The primitive variables like double and int are allocated in the stack, if they are local instances and in the heap if they are member variables. In Java functions and local variables are pushed into stack when a function is called and stack pointer is decremented when a method invoke is finished. In a multi-threaded application each thread may have its own stack but will share the similar heap. That is why care could be taken in your code to avoid any concurrent access concern in the heap space. The stack is thread-safe because each and every thread will have its own stack with say 1MB RAM allocated for each thread but the heap is not thread-safe unless protected with synchronization through your code. The stack space may be increased with the -Xss option.

Posted Date: 7/25/2012 2:25:41 AM | Location : United States







Related Discussions:- How does java allocate heap and stack memory?, Assignment Help, Ask Question on How does java allocate heap and stack memory?, Get Answer, Expert's Help, How does java allocate heap and stack memory? Discussions

Write discussion on How does java allocate heap and stack memory?
Your posts are moderated
Related Questions
Consider the following code? What input is needed for x in order for the sum variable that is output at the end of the code to be 12 ? (In other words: what do I need to make X be

1. Create a text file (you can name it sales.txt) that contains in each line the daily sales of a company for a whole month. Then write a Java application that: a. asks the user fo

1. Make a class Rational to provide at least following methos and constructors: Rational r1= new Rational (3,5); Rational r2= new Rational (4,7); Rational r3=r1.add(r2);

On the surface, an application context is similar as a bean factory. But application context offers much more.. ? Application contexts give a means for resolving text messages,

any one out there with Boggle Source code?......i really need it guys please.


Explain the for loop in java? // This is the Hello program in Java class Hello { public static void main (String args[]) { System.out.print("Hello "); // Say Hello

Explain the Order of Evaluation of Logic Operators ? When Java sees a && operator or a ||, the expression on the left side of the operator is evaluated first. For instance, con

Want simple functional website without any graphic work, like panel Project Description: I want a very simple look website .It should be like a panel. Few tab, contact form,

How Polylines draws in java language? Java automatically closes the polygons it draws. That is it draws polygons which look like the one on the right rather than the one on the