glutz
glutz

Reputation: 1959

How to efficiently load a native shared object using java

I have a 30MB shared object which is loaded into a java exe via system.load for example:

System.load("mylib.so");

It appears that this loads the complete binary into RAM, causing a 30MB penalty at run time. I am looking for a way to avoid that penalty by means of some paging setting or something similar that prevents the complete shared obj from loading all at once. I need to be more efficient with memory use on an embedded device and this 30MB is the biggest single chunk by far.

Is this possible to improve without actually reducing the size of the shared obj itself (which would be a massive undertaking by the way).

thanks.

Upvotes: 0

Views: 80

Answers (1)

Rocky Pulley
Rocky Pulley

Reputation: 23321

This is what System.load is going to do. The same thing happens in a native application, if you link with a so then it will load the whole thing in memory, java can't get around that.

Upvotes: 2

Related Questions