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
Prompt the user for an int between an upper and lower boundary. Reuse the validateInput() method from project 2 to validate if the input is in bounds. If it is not, print an error

Need JAVA,SPRING,JSF(primefaces) Application Support Project Description: We want someone to be part of our team's new development, it's minute application but in future, cha

Question 1: a) What is an "Operating System"? b) Describe the four main computer system components. c) Describe and compare "Parallel Systems" and "Distributed Systems

What is the role of fonts in java explain with example? You've already seen one instance of drawing text in the HelloWorldApplet program of the last chapter. You call the drawS

Explain BIOS in java language? BIOS basically stand for Basic input/output system it is also called as the system BIOS or ROM BIOS is a de facto standard describing a firmware

What are the different types of messages available in the JMS API? Ans) Message, TextMessage, BytesMessage, StreamMessage, ObjectMessage, MapMessage are the dissimilar messages

I need help on java homework. Is it possible to know the shortest possible time to get the solution before giving my commitment

For this assignment, you will develop the back end of a calculator application. The GUI (graphical user interface) has been provided by your instructor. The application will requir

The Naming class gives methods for storing and obtaining references to remote objects in the remote object registry.

Prepare a Game in Corona for Android and IOS Project Description: We want to develop a game for mobile platform same as Zombie Smasher for iOS and Android. Everything is r