jpype icon indicating copy to clipboard operation
jpype copied to clipboard

Memory Leak???

Open xiaoyu1095 opened this issue 4 years ago • 1 comments

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?

xiaoyu1095 avatar Mar 15 '21 08:03 xiaoyu1095

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.

magrusch avatar Mar 30 '21 23:03 magrusch