Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix memory/disk usage leak when creating many ScriptingContaiers #4747
This PR is to resolve #3928, File descriptors from stdlib jars are leaked when ScriptingContainers are terminated
It's very much a work in progress, and I was hoping to get some feedback on
This biggest problem I currently see with it is that I was unable to find a way to cleanup the jars and references without making the
The basic strategy here is:
In the case of a single threaded container, this should be safe. My understanding is that each single threaded container has its own class loader and context provider. Additionally, each time a container causes the class loader to extract a stdlib jar into a temp directory, it creates a uniquely named file for that class loader. So, removing these references will not affect any other scripting containers.
Since our use case in #3928 primarily involves using the single threaded local context scope, I've focused on that. But if this work should involve improvements to the other context providers we'd be happy to implement that as well.
So far I've been testing this manually by just creating scripting containers in a loop, giving them a script that requires a few stdlib jars, and verifying that the jars are created and destroyed on disk as expected. I've also been using yourkit to verify that the jar cache doesn't leak references
If it's looking good to you then I guess it's not a WIP.
According to https://docs.oracle.com/javase/7/docs/api/java/io/File.html#delete(),
PR looking good, but I do not understand why its only tied to