JDK-8244579 : Windows "User Objects" leakage with WebView
  • Type: Bug
  • Component: javafx
  • Sub-Component: web
  • Affected Version: 8u251,openjfx11,openjfx15
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_10
  • CPU: generic
  • Submitted: 2020-05-07
  • Updated: 2021-04-21
  • Resolved: 2020-05-21
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 8 Other
8u251Fixed openjfx11.0.8Fixed
Related Reports
Relates :  
Description
There seems to be a regression problem in 14.0.1 which causes a massive resource leak of Windows "User Objects" when using the WebView. The problem does not seem to happen with OpenJFX 14. 

I ran 2 instances of the sample, one with OpenJFX 14 and another with OpenJFX 14.0.1. After browsing the same links for 5-10 minutes, I took a reading from the "Task Manager" (image attached).

Steps to reproduce:

1. Open the Windows Task manager, go to the "Details" tab, right click any column header and from the resulting "Select Columns" dialog check the "User objects" checkbox.
2. Run the attached sample using OpenJFX 14.0.1.
3. "User Objects" increase as you navigate through the website and continue reading different news articles.

** Sample **

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.scene.web.WebView;
import javafx.stage.Stage;

public class WebViewUserObjectLeakage extends Application {

    @Override
    public void start(Stage stage) {

        WebView webview = new WebView();
        webview.getEngine().load("https://cnn.com");
        Scene scene = new Scene(new StackPane(webview));

        stage.setScene(scene);
        stage.setMaximized(true);
        stage.show();
    }

    public static void main(String[] args) {
        launch();
    }
}
Comments
Changeset: a13a642d Author: Arun Joseph <ajoseph@openjdk.org> Date: 2020-05-21 15:42:21 +0000 URL: https://git.openjdk.java.net/jfx/commit/a13a642d
21-05-2020

Cause: The Window Class `RunLoopMessageWindow` is never registered (this happens because registerRunLoopMessageWindowClass() is moved to MainThreadWin.cpp while openjfx uses MainThreadJava.cpp) and this causes every setTimer() to create a new user object instead of reusing the same object over again. Fix: Call registerRunLoopMessageWindowClass() from MainThreadJava.cpp
20-05-2020