memoryjvmoff-heap

Difference between On-heap and Off-heap memory


Can someone explain the difference between on-heap memory and off-heap memory?Does the off-heap memory show on the JVM memory size?Are the off-heap all pointers?


Solution

  • All memory is native memory, however the JVM manages and record memory in it's JVM heap (not the same as the native heap)

    Offheap is a Java term for memory not managed directly. However, it can be managed indirectly using direct ByteBuffer(s) as proxy objects for raw native memory.