jpype
jpype copied to clipboard
Memory Leak???
I found a problem with Java wrapper class,such as ...
java code:
import java.util.ArrayList; import java.util.List; public class Runner { public List<Integer> testListInteger(){ List<Integer> temp = new ArrayList<>(); for (int i = 0; i < 100000; i++) { temp.add(i); } return temp; } }
python code:
from xxx import Runner def test_run(): runner = Runner() for num in runner.testListInt(): a = num if name == 'main': for i in range(1000000): test_run()
I use the command “top -p pid” to observe the process memory usage, memory usage has been increasing. Only the String will be stable at a certain value. What should I do with it?
How is the memory usage if you run this in java only? So call testListInteger() recursively a million times in a java function. Paste both measurements (with jpype and with java only). What do you mean with "only string will be stable"? And please paste code in a code block so it's easier to read.