Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
scriptingcontainer native memory leak? #1791
We're experimenting with using JRuby to compile Puppet catalogs. We'd like to use a ScriptingContainer to give us some control over the JRuby instance.
Everything is working very well, but there are some memory issues that I'm having a hard time figuring out. The two main problems are:
I've put together a repro case here:
Connecting to the process after the ScriptingContainer goes out of scope, I can see that the heap still contains a large number of references to instances of this type:
So I'm suspicious that that may have something to do with it (mostly just based on the name of that class :) ).
It's possible/likely that the actual ruby code we're running inside of the JRuby ScriptingContainer has memory leaks that we need to fix, but I'd have guessed / hoped that GC'ing the ScriptingContainer would be a feasible workaround for freeing up that memory.
I don't have a tremendous amount of experience debugging JVM -> native memory allocation, so if anyone has any pointers on how to debug this, they'd be greatly appreciated! I'm also happy to take this to a mailing list, IRC, etc. if there is a more appropriate forum.
Heap dump of a run of this code, if anyone is interested:
I've been working w/ @cprice404 on this issue, and I was able to boil this down to a very simple program that seems to demonstrate a fairly severe native memory leak:
I'm very interested to hear any thoughts on this. Thanks!
@yokolet - Thanks for the response. Unfortunately, your proposed solution doesn't work for our use-case - we are using persistent ScriptingContainers that are initialized on application startup. Our main reason for doing this is that we need to load a relatively large ruby codebase into each container, and this is a time-consuming process. So we never