Search code examples
c++jvmsharedloaded

Will shared library used within and outside JVM get loaded twice


I have a C++ application which makes calls to functions in a shared library. The application also creates a JVM and calls some Java Code. The Java code might end up calling functions from the same shared library.

The question is will the shared library get loaded twice in the memory overwriting the first instance of load ? Will this lead to unintended crashes ?


Solution

  • The question is will the shared library get loaded twice in the memory overwriting the first instance of load?

    No. The operating system will only load it once. Thereafter it will only increase a usage count.

    Will this lead to unintended crashes?

    No.