How does java allocate heap and stack memory?, JAVA Programming

Assignment Help:

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.


Related Discussions:- How does java allocate heap and stack memory?

Implement relationship using a java program, Implement relationship using a...

Implement relationship using a java program. Assume each course has a course title, code, subject and number of credits while each student has a name, registration number, list of

How to use dispatchaction, To use the DispatchAction, follow these steps: ...

To use the DispatchAction, follow these steps: ? Make a class that extends DispatchAction (instead of Action) ? In a new class, add a method for each function you need to per

What is preferred organizational structure for organization, What is the pr...

What is the preferred organizational structure for the organization? Preferred Organizational Structure for organization is hierarchal. Where there is various departments inter

Stream as an object, What interface must an object implement before it can ...

What interface must an object implement before it can be written to a stream as an object?      Ans) An object must execute the Serializable or Externalizable interface before i

Program to insert item in tree, public class TreeTest {     public static v...

public class TreeTest {     public static void main(String args[])     {         Tree t = new Tree ();         System.out.println("Populating");         t.insertItem(1);         t

Introduction, the multiple of two number in java

the multiple of two number in java

Explain the execute phase of java program development, Explain the Execute ...

Explain the Execute phase of Java Program Development Finally in phase computer, under the control of its CPU, interprets program one bytecode at a time. Hence performing

How the jms is different from rpc, In RPC the method invoker waits for the ...

In RPC the method invoker waits for the method to finish implementation and return the control back to the invoker. Therefore it is completely synchronous in nature. Whereas in JMS

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd