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
Develop a rfid based student attendance system include biometrics Project Description: The aim of our project is using rfid technology student attendance has to be taken. whe

Write a program of else statement in java? The else statement in Java // This is the Hello program in Java class Hello { public static void main (String args[]) { if (

Describe Importing Classes in java? Fully qualified names such as java.net.URL are not the most convenient thing to have to type. You can use the shorter class names like URL w

write a program in java which enters name,roll #,and shows the sum of students english and maths marks?

Universal Android and iOS, Multipurpose Testing Application - Based on Phonegap Project Description: Universal Android and iOS, Multipurpose Testing Application Based on Phon

design a payrol (non GUI)

Project Description: We need to develop software that has a database of players with the ability to delete and add players at will, once captured there can be a draw to set them

Agile software development process is receiving popularity  and  momentum  across organizations. Highest priority is to satisfy the end user. Welcome requirement modifie

i am to find 75% of i clicker score.Each correct answer is worth 2points and an incorrect 1point. Express grade as a percentage (i.e the max is 100%). e.g 1 no i clicker question

Normal 0 false false false EN-IN X-NONE X-NONE