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

Native memory leak in font layout subsystem

    Details

    • Subcomponent:
      2d
    • CPU:
      x86
    • OS:
      windows_8

      Description

      FULL PRODUCT VERSION :
      java version "9-ea"
      Java(TM) SE Runtime Environment (build 9-ea+116)
      Java HotSpot(TM) 64-Bit Server VM (build 9-ea+116, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.3.9600]

      Can be reproduced on Linux as well.

      A DESCRIPTION OF THE PROBLEM :
      A native-memory leak in font layout subsystem seems to have been introduced in JDK 9. It must be related to Harfbuzz integration, as the issue is not reproduced in JDK 8, and in JDK 9, if program is run with -Dsun.font.layoutengine=icu VM option.


      REGRESSION. Last worked in version 8u92

      ADDITIONAL REGRESSION INFORMATION:
      java version "1.8.0_92"
      Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the sample program given below.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Native memory consumption stays at more or less constant level after program 'warms up'.
      ACTUAL -
      Program's native memory consumption (as shown by Windows Task Manager) increases at a rate of about 200 MB per minute on my machine (Intel Core i7).

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.*;
      import java.awt.font.FontRenderContext;
      import java.util.Collections;

      public class MemLeakTest {
          public static void main(String[] args) {
              Font font = new Font(Font.MONOSPACED, Font.PLAIN, 12);
              FontRenderContext frc = new FontRenderContext(null, false, false);
              char[] text = String.join("", Collections.nCopies(1000, "a")).toCharArray();
              while (true) {
                  font.layoutGlyphVector(frc, text, 0, text.length, Font.LAYOUT_LEFT_TO_RIGHT);
              }
          }
      }

      ---------- END SOURCE ----------

        Attachments

          Activity

            People

            • Assignee:
              prr Philip Race
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: