Skip to Main Content

Loading same dll more than once in a Java JVM

Arun SanbhatAug 23 2018 — edited Aug 24 2018


We are currently using Java JRE 1.8 u 131 on WINDOWS. We have a java standalone desktop application that loads a C dll for processing of data.This it does by loading the dll using System.LoadLibrary("Name of the dll") function call.

Currently the Java application is single threaded and is processing the data using JNI functions written in C classes inside the dll.

Due to increase in the data by many folds, we would want to make the java application multi-threaded. The C side code does not support multi-threading and cannot be changed due to legacy issues. So we plan to use Java multithreading feature and load the same dll in each thread.

Each thread should process the data separately. However I am not sure if this will work. Can someone please inform me if a dll when loaded by any one of the Java threads, can other thread also be able to load it again? Will the dll would be loaded in a single memory space in the JVM or can each dll will be allocated a separate memory that can be only be accessed by the thread that has loaded it?

Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked due to inactivity on Sep 21 2018
Added on Aug 23 2018