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
Need to develop a Small Android App using Text to speech and Speech to Text feature. Project Description: When the Android App Opens, It will connect to Windows Azure cloud,

Admin panel to upload my html, php, psd templates Project Description: -Upload my psd file and convert -Login panel -Client login panel -Encryption code -Send dem

Explain the Polymorphism principle. Polymorphism can be referred as one name many forms. It's the ability of methods to behave differently, relying upon the object who is calli

Loosely coupled SOA SOA gives in loosely coupled application elements, in which message is not necessarily tied to a particular database. Loose coupling actives enterprises to

What is use of join in Java Threading

Staging areas that have messages those have been sent and are waiting to be read. Note that, contrary to what the name queue suggests, messages don't have to be delivered in the or

Integration: Neo4J, OpenGeo, Ikanow Project Description: I have an ongoing project to loosely integrate a variety of existing Open Source products: OpenGeo (geospatial server

What is the preferred organizational structure for the organization? Preferred Organizational Structure for organization is hierarchal. Where there is various departments inter

Project Description: Two co-founders are in search of a developer to join us to launch a tech startup. We have experience at fortune 500 companies, elite consulting firms, etc.,

Java program will be take data from excel files (left diagram), and uses can be able to enter the input(middle diagram) in website when run the input the result appear in Pie 2D or