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
CHEMISTRY PROBLEMS

How to catch multiple exceptions explain with example? If multiple blocks match the exception type, the first block in which matches the kinds of the exception catches it. pub

Project Description: I am seeking someone to prepare a small Android app for a promotional offer. It must be designed for use on an Android tablet. Fundamentally, a user will


How many static initializers can you have ? As many as you want, but the static initializers and class variable initializers are implemented in textual order and may not refer

Write a Java Applet which will draw a face on applet as follows:   b)    Modify the program now by adding two Buttons (Java version of ActiveX Control) named Smily Fac

Due to impedance mismatch between relational technology and object you need to understand the progress of mapping classes (objects) and their relationships to tables and relationsh

How can I connect my java application with xampp

Project Description: I need Team speak 3 client for Nokia Symbian platform. Project for Nokia E72, but should work on all Java/Symbian mobiles. Feature list should include

Project Description: Overview I am seeking an Oracle ADF mobile app and web service to be created that takes a list of contacts stored on an Android mobile phone or tablet an