Hi JavaFX-team.
I use javafx (webview) to work with googlemap in swing-application.
I have some problems with memory leaks.
In an attachment, a simple test application (written in IntelliJ IDEA community edition).
Test 1 (SimpleMap - button) - View map without creating objects in java-js bridge.
- Create JFXPanel, add there WebView. Display local html-page component google-map (taken from examples google-map).
- Then simply scroll the map, panning and see the memory usage (in task manager). It will be about 400-500 MB.
- Then remove from JFXPanel JPanel (Rem Map (Soft) - button). Also had to retire WebView. But the memory has not returned to previous levels.
- Repeat the test. Only now remove JFXPanel, and then call Platform.exit () (Rem map (Hard) - button). Now it is impossible to create JFXPanel (Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: Platform.exit has been called). Enjoying the memory usage (task manager) - about 400 MB, watch size Java Heap - about 60 MB. Why after Platform.exit () does not return the memory occupied naitive libraries?
Test-2 (Map with marker Managment - button) - View map detail, creating objects (markers) using java-js bridge.
- There are two ways to transfer data via java-js bridge. The first is to pass in js a java-object directly (variable or plain array of variables) - "mapRef.call (" createMarker ", javaObject []);". Second, pull method js, which in turn causes a java-method and pass it JSObject, in this JSObject data will be inserted through the "setSlot ()".
- Button "Add markers (direct plaun [])" - for the first method. Create 100 markers. This method consumes a lot of memory and slow.
- Button "Add markers (callback js data)" - for the second method. It also creates a 100 markers. A cleaner and faster method, but the memory is also not returned.
- Button "Del markes" - removes 100 markers by clik. After removal of the js-object memory is not returned.
In my application, the memory usage goes up to 1.5GB for 1-2 hours and then the application dies.
I use javafx (webview) to work with googlemap in swing-application.
I have some problems with memory leaks.
In an attachment, a simple test application (written in IntelliJ IDEA community edition).
Test 1 (SimpleMap - button) - View map without creating objects in java-js bridge.
- Create JFXPanel, add there WebView. Display local html-page component google-map (taken from examples google-map).
- Then simply scroll the map, panning and see the memory usage (in task manager). It will be about 400-500 MB.
- Then remove from JFXPanel JPanel (Rem Map (Soft) - button). Also had to retire WebView. But the memory has not returned to previous levels.
- Repeat the test. Only now remove JFXPanel, and then call Platform.exit () (Rem map (Hard) - button). Now it is impossible to create JFXPanel (Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: Platform.exit has been called). Enjoying the memory usage (task manager) - about 400 MB, watch size Java Heap - about 60 MB. Why after Platform.exit () does not return the memory occupied naitive libraries?
Test-2 (Map with marker Managment - button) - View map detail, creating objects (markers) using java-js bridge.
- There are two ways to transfer data via java-js bridge. The first is to pass in js a java-object directly (variable or plain array of variables) - "mapRef.call (" createMarker ", javaObject []);". Second, pull method js, which in turn causes a java-method and pass it JSObject, in this JSObject data will be inserted through the "setSlot ()".
- Button "Add markers (direct plaun [])" - for the first method. Create 100 markers. This method consumes a lot of memory and slow.
- Button "Add markers (callback js data)" - for the second method. It also creates a 100 markers. A cleaner and faster method, but the memory is also not returned.
- Button "Del markes" - removes 100 markers by clik. After removal of the js-object memory is not returned.
In my application, the memory usage goes up to 1.5GB for 1-2 hours and then the application dies.