PrepZone Logo
PrepZone
Back to Java

Java · Hard

What is off-heap memory in Java? When and why would you use it?

JavaAdvanced JavaMemory & JVM

Answer preview

Off-heap memory (direct/native memory) lives outside the JVM heap. It is not managed by the garbage collector and must be allocated and freed explicitly (or via Cleaner/PhantomReference).…