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
Project Description: I'm using a php script called phpfox on my site its work as social network . So I need is to use this script as CMS for my application. What users wil

Can you help? this assignment I will need to build a very straightforward and fully functional machine learning classifier with the K-Nearest Neighbor (KNN) algorithm. The KNN mode


How to get all the registered objects in a rmiregistry? Ans) Using list method of Naming Class.

Socket and ServerSocket. ServerSocket is used for normal two-way socket communication. Socket class permits us to read and write by the sockets. getInputStream() and getOutputStrea

Explain the Remainder or Modulus Operator in Java? Java has one significant arithmetical operator you might not be familiar with, %, also called as the modulus or remainder ope

what are the steps of object oriented programming language?

What is linear search? It is the simplest form of search. It searches for the element sequentially starting from first element. This search has a drawback if element is located

The non-final functions are clone (), finalize (), toString (), equals () , hashCode () and. The other methods like wait (), getClass (), notifyAll (), notify () etc are final

Write code in JavaScript language to show the odd numbers among 20 to 100 using FOR statement. Note: No requirement to write whole HTML program. Just JavaScript code of need p