JDK-8089857 : JVM crash due to memory leak when try to make operations on google map in WebView/WebKit
  • Type: Bug
  • Component: javafx
  • Sub-Component: web
  • Affected Version: 8u20,8u31,8u40
  • Priority: P2
  • Status: Closed
  • Resolution: Cannot Reproduce
  • Submitted: 2015-03-13
  • Updated: 2015-07-29
  • Resolved: 2015-07-29
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Resolved
Related Reports
Duplicate :  
Description
We are developing a JavaFX application which shows large number of houses(16000).

When we try to put large number of markers(16000) on google map, the memory utilization for that java process get increased continuously and machine/application get crashed (After allocating more that 2.5Gb of memory to the java process). 
This application works fine with java 7 (version 1.7.0_71) but when we upgrade the version of java to java 8 memory utilization for java process get increased.

In this application we iterate through a list of houses and and buffer lattitude and longitude of each house in JSONArray and when length of JSONArray becomes more than 5000 we make a javascript call for putting markers for those houses(5000 at once).
We buffer information of each house because if we make a javascript call for each houses while iterating a list from java then we almost make thousands of javascript call unnecessarily and even we use java 7 application get crashed. 

Observations:
1. If we  make thousands of javascript functions call from java without performing any operation on map (just print logs) all works fine.
2. Memory utilization increases only when we make operations on map.
3. Memory allocated to the java process never get decreased even if heap memory get decreased.
4. If we comment out JavaScript calls from java then memory utilization is fine and application is also working fine.
We also observed that whatever memory allocated to the Java Process/JavaScript/WebEngine/WebView/Webkit is not deallocated even if you perform GC from jvisualvm, so memory is always allocated and never claimed back to the operating system(Note: This happens with java 7 also).

Steps to reproduce this issue
1. Create a JavaFX application
2. Add webview in it
3. Load google map on webview (Use google maps javascript api v3)
4. Add JavaFX button
5. On click of button try with following two options
	A. Pass long json array (more than 15000 records) at once containing lattitude and longitude to javascript OR
	B. Break that array (size of 5000) and pass one by one to javascript. 
	Observations:
	With the first option javascript will receive all records but some of it will get skipped while putting it on map. (Tested on java 7)
	The second option works fine in java 7 but in java 8 gives memory leak
6. In javascript parse that array and try to put marker for each record 

Observatios:
I have separated out the html page and try to put markers on it using chrome and it works fine. Just to check if there is any leak in google map.

Comments
The submitter is inactive, so I'm closing the bug as not reproducible.
29-07-2015

I'm running it with the latest 8u60/9. No crash is reproducible. I see the increase of RAM up to 100-200 Mb, but not 2.5Gb as stated in the description. (The crash could be fixed with some recent fixes). As to manipulations with google maps like zooming in/out. This indeed can consume a gigabyte of VRAM (not RAM), which can be tracked with -Dprism.poolstats=true. This issue is tracked separately: https://bugs.openjdk.java.net/browse/JDK-8089049. So, I'd suggest J. Duke to check the behavior with latest 8u60/9 (which can be downloaded as EA builds). If it's not reproducible, I'll close the bug.
25-06-2015

Attached file provide by bug submitter.
19-03-2015

Dheeraj, thanks for your input. So far the source of the problem is unclear, so it's hard to say if there exists any workaround. The issue is critical, so we will definitely investigate it in the possible nearest time.
19-03-2015

I have also tried with mapbox (With clustering markers) instead of google map but the results are same when u zoom in to each marker.... I have send a mail of that html to Kevin Is there any work around for this functionality....Java 9 is about to release in 2016. If u run the given html's (googlemap or mapbox) inside chrome browser and check memory utilization. The memory allocated to the chrome process does not get increase more than 150Mb . And the given sample application works fine in java 7 (It takes more memory than chrome process but at least work) so what is the problem with java 8. I also observe if we do zoom in and out on google map memory get increase even if we dont put markers on it. thanks for reply...
19-03-2015

Seems like a duplicate of RT-35262.
18-03-2015

I see that you updated the description. However, in regards to the following: >1. Create a JavaFX application >2. Add webview in it Please provide the source code for this application (you can paste it into a comment or email it to Anton or me and we will attach it).
16-03-2015

Attached test case provided by bug reporter.
16-03-2015

Hey Kevin please check mail i have send u sample code for reproducing this issue.
16-03-2015

Please provide a complete reproducible test case. See https://wiki.openjdk.java.net/display/OpenJFX/Submitting+a+Bug+Report Marking as incomplete pending a test case.
13-03-2015

This is a P2 issue, and probably a duplicate. Can you try it on JDK 9 early access (b52 or later)? The WebKit version has been update there, and is in the process of being backported to 8u60.
13-03-2015