|
Heap
|
- the heap is where your Class instantiations or “Objects” are stored
|
|
Thread Stacks
|
- each thread has its own call stack
- the stack stores primitive local variables and object references along with the call stack (list of method invocations) itself
- the stack is cleaned up as stack frames move out of context so there is no GC performed here
|
|
Metaspace
(PermGen in older Java versions)
|
- metaspace stores the Class definitions of your Objects, and some other metadata
|
|
Code Cache
|
- the JIT compiler stores native code it generates in the code cache to improve performance by reusing it
|
|
Garbage Collection
|
- in order for the GC to know which objects are eligible for collection, it needs to keep track of the object graphs. So this is one part of the memory lost to this internal bookkeeping
|
|
Buffer Pools
|
- many libraries and frameworks allocate buffers outside of the heap to improve performance
- these buffer pools can be used to share memory between Java code and native code, or map regions of a file into memory
|