Thursday 13 February 2014

Heap Memory

Heap is a portion of memory where dynamic allocation and de allocations happen

Heap memory is slightly slower to read from and written to, because pointer access is needed to access heap memory

The JVM allocates Java heap memory from the OS and then manages the heap for the Java application.

Heap doesn't have any restrictions on memory size, it totally depends on Hardware.

Possibility of memory leak, if the heap is not organized properly

What are the initial heap size for an Application
Ideally it is platform and JVM dependent.

Initial Heap values for IBM Java
Platform

Initial size
Maximum Size
AIX®
4 MB
64 MB
IBM® i
4 MB
2 GB
Linux®
4 MB
Half the real memory with a minimum of 16 MB and a maximum of 512 MB
Windows®

4 MB
Half the real memory with a minimum of 16 MB and a maximum of 2 GB
z/OS®
1 MB
64 MB

Initial heap size for Oracle Java
On Server class machines
    initial heap size:
    Larger of 1/64th of the machine's physical memory on the machine or some reasonable minimum. Before J2SE 5.0, the default initial heap size was a reasonable minimum, which varies by platform. You can override this default using the -Xms command-line option.

maximum heap size:
    Smaller of 1/4th of the physical memory or 1GB. Before J2SE 5.0, the default maximum heap size was 64MB. You can override this default using the -Xmx command-line option.

Usefule Links




Increase stack size                                                 Increase Heap Size                                                 Home

No comments:

Post a Comment