Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8163252

JavaFx WebView uses too much heap for web pages with lots of images

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P2
    • None
    • 8u91
    • javafx
    • JavaSE8u91 Linux/Windows-x86/x64 VMs

    • web
    • x86
    • windows

    Description

      If you go to a web page with many images, JavaFx WebView uses way too much heap to load the web page.

      For example, this particular web page has 340 images:

      https://github.com/d3/d3/wiki/Gallery

      JavaFx WebView takes around 6.7 GB of heap in order to render the page.
      Firefox takes around 500 MB.

      Here are some example heap overflow stacks if you only set you heaps to 2 GB or so:

      {code}
      Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space
              at com.sun.javafx.iio.gif.GIFImageLoader2.decodePalette(GIFImageLoader2.java:323)
              at com.sun.javafx.iio.gif.GIFImageLoader2.load(GIFImageLoader2.java:234)
              at com.sun.javafx.iio.ImageStorage.loadAll(ImageStorage.java:364)
              at com.sun.javafx.iio.ImageStorage.loadAll(ImageStorage.java:274)
              at com.sun.javafx.webkit.prism.WCImageDecoderImpl.loadFrames(WCImageDecoderImpl.java:173)
              at com.sun.javafx.webkit.prism.WCImageDecoderImpl.loadFrames(WCImageDecoderImpl.java:186)
              at com.sun.javafx.webkit.prism.WCImageDecoderImpl.addImageData(WCImageDecoderImpl.java:109)
              at com.sun.webkit.network.URLLoader.twkDidFinishLoading(Native Method)
              at com.sun.webkit.network.URLLoader.notifyDidFinishLoading(URLLoader.java:838)
              at com.sun.webkit.network.URLLoader.lambda$didFinishLoading$98(URLLoader.java:829)
              at com.sun.webkit.network.URLLoader$$Lambda$314/1527838714.run(Unknown Source)
              at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
              at com.sun.javafx.application.PlatformImpl$$Lambda$179/203274438.run(Unknown Source)
              at java.security.AccessController.doPrivileged(Native Method)
              at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
              at com.sun.javafx.application.PlatformImpl$$Lambda$178/1044483803.run(Unknown Source)
              at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
              at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
              at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
              at com.sun.glass.ui.win.WinApplication$$Lambda$167/1747735167.run(Unknown Source)
              at java.lang.Thread.run(Thread.java:745)
      {code}

      Attachments

        Issue Links

          Activity

            People

              arajkumar Arunprasad Rajkumar
              gucheng Guixin Cheng
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: