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
Write a JavaScript program to prompt the user for the radius of a sphere and call function sphereVolume to calculate and display the volume of the sphere in the status bar.

The Remote interface serves to recognize interfaces whose methods may be invoked from a non-local virtual machine. Any object that is a remote object must directly or indirectly ex

Need Android GeoLocation Service App Project Description: I want an android service app that will run on the background. The app has to get the users location (latitude an

how to retrieve data from Excel file, and display that data in table on jsp page?

We want the best java programmer available. Project Description: Java | Portlets| JSF Liferay (not essential but is preferable) Big Data and User online tools. Multilin

1.) Write an application with two user transactions (login which includes viewAllStudents and viewStudent ) with full MVC architecture that displays the details of the selected

Question 1 What are the different types of data types in java? Question 2 Write a note on Operator Precedence Question 3 Write a note on Random access files

Develop a Farm Production System Project Description: I want software that will allow me to input/record the each day production of our farm and allow me to view the data bac

Is it possible to create any dialog window in Oracle in Java stored procedure?

What is Multiple Inheritance ? A few object oriented languages, notably C++, permits a class to inherit from more than one unrelated class. This is known as multiple inheritanc