2

I had written a software by using javaFx but I noticed memory leak in JVM so after 5 minutes it will stop with an OutOfMemoryError.

I search alot but I did not find solution. I will share code about openinig new page in same stage and scene

DashboardController.centerStatic.getChildren().clear();
FXMLLoader fl =new FXMLLoader("page.fxml",Lang.getResourceBundle());

//static centerStatic    
DashboardController.centerStatic.getChildren().setAll((AnchorPane)fl.load());

when I call the new page it will execute queries and adding listeners and eventhandlers so it will fill memory with 50 mb but after call new page it is not free the memory
so I get memory leak after 5 minutes

please help us thanks

fabian
  • 80,457
  • 12
  • 86
  • 114
Salim Vela
  • 31
  • 2
  • yes I mean OutOfMemoryError , and I close all opened resources – Salim Vela Mar 03 '16 at 15:15
  • The listeners are probably stopping GC. You may want to read about https://docs.oracle.com/javase/8/javafx/api/javafx/beans/value/WeakChangeListener.html – brian Mar 03 '16 at 15:54
  • Thank you for your replay , I change all listeners to weaklisteners but it still get big memroy and make memory leak ? – Salim Vela Mar 04 '16 at 12:40
  • It's very hard to diagnose, even if you showed all the code. I suggest https://visualvm.java.net/ . It's already in your jdk and your ide probably has a way to use it as well. – brian Mar 04 '16 at 15:46

0 Answers0