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
Java platform is a software-only platform independent, which runs on top of other hardware-based platforms like WINDOWS, UNIX, NT etc.   The Java platform has 2 main com

Explain switch statement in java language? Switch statements are shorthands for a certain type of if statement. It is not common to see a stack of if statements all related

Explain primitive data types in java? Java's primitive data types are extremely similar to those of C. They involve boolean, byte, short, long, int, float, double, and char. Th

Develop Billing Software Project Description: Need software to print bills on A4 paper in the format provided. The details are shown below - 1. Serially generated Invoice

how can i add script code in anouncement of a channel in a massneger the massnegr suport that but do not published it please help me please:((((((((((((((((((((((((((((((((((((((((

Modules of software: 1 - Serial RS232 comm port comunication 2 - NanoHTTPD serving some processed pages 3 - System tray application to indicate status and access configura

Explain function arguments with the help of an example? Arguments on a function are comma separated list of data enclosed within braces. It describes interface among the web pa

what is thread synchronization

how can i create an E-exam application on netbeans

Modify both of the above clients (to write separate clients) to extract the exchange rate from a live web service that performs currency conversion. You can choose a Java or a .NET