terl / lazysodium-java

A Java implementation of the Libsodium crypto library. For the lazy dev.
https://github.com/terl/lazysodium-java/wiki
Mozilla Public License 2.0
134 stars 46 forks source link

LazySodium creates folders "resource-loader*" under /tmp folder #126

Open morganteg opened 1 year ago

morganteg commented 1 year ago

Using LazySodium in a Java Main, simply instantiating it, I noticed that one or more folders named "resource-loader*" are crated. These folders are quite huge in terms of size.

Is there a way to avoid LazySodium to write on disk, hence to create folders under /tmp, as well?

tonybaines-lendable commented 5 months ago

I think you may be doing the same thing I was and missed the bit from the docs

The first step to getting started with Lazysodium is to create a sodium object. The sodium object should be initialised only once as it loads the native C Libsodium library.

We were (indirectly) creating a new instance with each request, leading to /tmp filling and what presented as kernel/rss memory leak.

I'm super grateful for your issue report though, I'd been diving into linux kernel memory models trying to figure out where all the RAM was being eaten until I spotted this and it made be think,