Heap memory:
What- it is used by jvm to store all the objects created in a project.
What- it is used by jvm to store all the objects created in a project.
Heap memory is divided into three generations-young , old, permanent area of heap
First object gets created in young gen space after it gets referenced to null it moves to old gen space
Permanent area of space is used to store meta data related to classes and methods.
If there is no memory JVM will through Java. lang.outofmemoryerror
There are two types of out of memory errors
1. lang.outofmemoryerror.heap memory
2. lang.outofmemoryerror.perm generation
To increase the heap memory by the JVM options as shown below
There are two types of out of memory errors
1. lang.outofmemoryerror.heap memory
2. lang.outofmemoryerror.perm generation
To increase the heap memory by the JVM options as shown below
Xms <start size> xmx <Max size>
Permanent gen memory error can be caused if we have too many classes or huge number of strings in the project
It is also called due to memory leaks through class loaders in application servers
Different
Permanent area of space can be increased by below JVM options
It is also called due to memory leaks through class loaders in application servers
Different
Permanent area of space can be increased by below JVM options
Xx:permsize and xx:maxpermsize
Stack memory:
It is small block of memory used by JVM to store function classes and local variables.
Each thread will have their own stack memory which can be specified using -xss JVM option.