pyjnius
pyjnius copied to clipboard
Dereferencing JVM objects
I'm trying to figure out how/if the JVM objects I create get dereferenced and available for garbage collection.
Was trying:
In [1]: import jnius
In [2]: jString = jnius.autoclass("java.lang.String")
In [8]: def abc():
...: x=jString("a" * (256 * 1024 * 1024))
...: # do something complex which creates a lot of big variables utilizing lots of RAM
If I call abc()
multiple times, would the JVM automatically figure out that after function abc() finishes, all the Java objects created there can be garbage collected ?
I seem to be having memory issues and am trying to understand how memory management happens in the JVM with jnius