转)Understanding Java Memory Management
Understanding Java Memory Management - IBM
Java Native Interface (JNI) Objects and Code
Java Native Interface code can directly allocate native memory using system calls:
– malloc, calloc, realloc etc.
Uses memory from the memory from the process address space
– Just like the Java heap does
Some Java Class Library code uses JNI, and therefore allocates native memory
– java.lang.Class
– java.lang.Thread
– java.net.Socket
– java.util.ZipFile
– java.nio.ByteBuffer (if allocated as direct)
Objects that use small amount of Java heap, may use much larger quantities of native memory
– Classes, Threads and (direct) ByteBuffers are good examples
Example: java.lang.Class objects
Example: java.lang.Class objects