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
Question: A new software engineer has joined Axistex Ltd. The systems analyst informs him that the organisation works with different operating system. The HR department works w

What is difference between time slicing and preemptive scheduling? Differences between preemptive and time scheduling are: In case of Preemptive scheduling the highest prior

Hospital Management System: Technology Used Java-JSP, Apache Tomcat (webserver), SQL SERVER 2000. This project is aimed at developing a web-based system for taking records

• Study and enhance the File System Simulator - See the FS_sim slide deck • New features - blockinfo - a new application that displays the information about the blocks in the file

Explain Subclasses and Polymorphism ? Car and Motorcycle are subclasses of MotorVehicle. If you instantiate a Car or a Motorcycle along with new, you can use in which object a

I want to develop a Chat application for j2me Project Description: We require a chat application for a community website. Skills required: Java, J2ME


I want FitLIFE app for Android, IOS, Windows Project Description: Hello, I want to develop an app for Android, IOS and Windows Phone. This app will be work with open source B

Describe The ? operator in Java langauge? The conditional operator just works for assigning a value to a variable, using a value within a method invocation, or in a few other w

How can you define a consistent web design? Why is it needed? A consistent excellent designed website is generated for common public which permits users to attain what they nee