简体   繁体   中英

Java: When DLLs are loaded by a ClassLoader where are they stored in memory?

My understanding is that the .dlls are loaded into java.library.path by a ClassLoader but where are they stored in memory after System.loadLibrary() and System.load() is called from a non-static procedure?

JVM内部架构

When the System.loadLibrary() or System.load() functions are called, the ClassLoader for the current Java class is tasked with finding the requested DLL (and its dependencies) and informing the operating system about the libraries' locations. The ClassLoader itself does not perform any loading: this operation uses the Java Native Interface (JNI) libraries to communicate with the operating system and tells it where to look for the requested libraries.

When a DLL function is called, the function is loaded into the address space of the Java VM process and is executed there. This address space is a memory block given to a process by the operating system and is separate from the Java VM altogether. So, the answer to your question is that the Java VM simply uses its given address space to load DLL functions on-demand and executes them through the Java Native Interface.

Source: http://www.webbasedprogramming.com/Tricks-of-the-Java-Programming-Gurus/ch30.htm

'Non-static procedure' has nothing to do with it. Neither does the Java heap, and neither does Java, or your picture. The code is mapped into the process's code space and the data is mapped into the process's data space.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM