JavaFX Memory leak

Ty Young youngty1997 at gmail.com
Mon May 4 19:58:41 UTC 2020


Hi,


I'm trying to debug a memory leak in my application using Java Mission 
Control & Flight Recorder[1]. Going down the tree it gives, it seems to 
be caused by this code:


Series<Integer, Long> series = super.getSeries();

ObservableList<Data<Integer, Long>> points = series.getData();

if(points.size() > super.getSeconds().get()-1)
{
     points.remove(super.getSeconds().get()-1);

     points.add(0, new Data(0, readable.getValue().get().longValue()));
}
else
     points.add(0, new Data(0, readable.getValue().get().longValue()));

for(int i = 1; i < points.size(); i++)
{
     Data data = points.get(i);
     data.setXValue(i+1);
}


...but doing a print statement to print the size of the Points list 
shows that the max size is always 60, as expected.


This increase in memory is consistent with multiple recordings, so I do 
think it's a leak but I have no idea what's causing it. Is this leak 
from JavaFX's end or my code?


[1] https://imgur.com/a/oNYb6Q7



More information about the openjfx-dev mailing list