Java Memory
Java memory is divided into followings:
- Heap: To store objects. These are shared values and not thread safe. Heap can further divide into:
- New Generation
- Old Generation
- Stack: Each thread has its own stack. store local variables and method call information.
- Metaspace: Native memory space that stores class metadata, constant pool information, and method bytecode. It was introduced in Java 8 as a replacement for PermGen.
Good Reads:
Memory leaks can be identify by memory profilers(e.g., VisualVM, Java Control Mission) , verbose garbage collection(add -verbose:gc JVM param) and Heap Dump.
