This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 250307 - OutOfMemoryError: Java heap space
Summary: OutOfMemoryError: Java heap space
Status: VERIFIED FIXED
Alias: None
Product: debugger
Classification: Unclassified
Component: Java (show other bugs)
Version: 8.1
Hardware: All All
: P3 normal (vote)
Assignee: Martin Entlicher
URL:
Keywords:
: 256191 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-02-09 11:00 UTC by Jiri Kovalsky
Modified: 2015-10-27 14:10 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 215283


Attachments
stacktrace (2.46 KB, text/plain)
2015-02-09 11:00 UTC, Jiri Kovalsky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Kovalsky 2015-02-09 11:00:44 UTC
Build: NetBeans IDE Dev (Build 201502090001)
VM: Java HotSpot(TM) 64-Bit Server VM, 25.25-b02, Java(TM) SE Runtime Environment, 1.8.0_25-b17
OS: Linux

User Comments:
jkovalsky: Occurred when trying to reproduce issue #250305.




Stacktrace: 
java.lang.OutOfMemoryError: Java heap space
   at sun.font.StandardTextSource.<init>(StandardTextSource.java:100)
   at sun.font.TextLabelFactory.createExtended(TextLabelFactory.java:132)
   at java.awt.font.TextLine.createComponentsOnRun(TextLine.java:1030)
   at java.awt.font.TextLine.getComponents(TextLine.java:1099)
   at java.awt.font.TextMeasurer.generateComponents(TextMeasurer.java:287)
   at java.awt.font.TextMeasurer.ensureComponents(TextMeasurer.java:499)
Comment 1 Jiri Kovalsky 2015-02-09 11:00:46 UTC
Created attachment 151899 [details]
stacktrace
Comment 2 Martin Entlicher 2015-02-09 12:50:22 UTC
I've reproduced this :-(
Comment 3 Martin Entlicher 2015-02-09 14:58:23 UTC
This is reproducible only with special characters that are displayed in a TextArea.
This is a shortest sequence that I've identified: "\uDC00\uD802\uDFFF"
which when repeated 5000 times, creates cca 600MB objects on heap.
This looks like a Swing memory defect.

To fix this, i need to find out what triggers this insane behavior and then limit the number of displayed characters more severely.
Comment 4 Martin Entlicher 2015-02-09 15:19:55 UTC
This is a regression in JDK. In JDK 7 the memory usage is O.K.
It may be a result of http://hg.openjdk.java.net/jdk8/jdk8/jdk/rev/aca4a67e560d
Comment 5 Martin Entlicher 2015-02-09 15:41:04 UTC
I've submitted a defect for JDK:
https://bugs.openjdk.java.net/browse/JDK-8072775
Comment 6 Martin Entlicher 2015-02-09 16:44:41 UTC
"Fixed" in NetBeans by lowering the limit to 1000 characters on JDK 8:
changeset:   283903:f2a9b7fce1b6
http://hg.netbeans.org/core-main/rev/f2a9b7fce1b6
Comment 7 Quality Engineering 2015-02-10 05:43:35 UTC
Integrated into 'main-silver', will be available in build *201502100301* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/f2a9b7fce1b6
User: mentlicher@netbeans.org
Log: #250307: Limit the maximum String length to 1000 characters on JDK 8, due to big memory consumption spent on some Strings in JDK 8.
Comment 8 Jiri Kovalsky 2015-02-10 11:01:22 UTC
Product Version: NetBeans IDE Dev (Build 201502100301)
Java: 1.8.0_25; Java HotSpot(TM) 64-Bit Server VM 25.25-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_25-b17
System: Linux version 3.13.0-24-generic running on amd64; UTF-8; en_US (nb)

Seems to work fine now with the limit. There is still possibility to save the property's value to file. Thanks for the quick fix.
Comment 9 Martin Entlicher 2015-07-02 09:49:53 UTC
The JDK bug was fixed in 1.8.0 update 60.
Therefore I've added a check for the update number:
changeset:   289348:88cf772ace61
http://hg.netbeans.org/core-main/rev/88cf772ace61
Comment 10 Quality Engineering 2015-07-04 02:08:29 UTC
Integrated into 'main-silver', will be available in build *201507040001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/88cf772ace61
User: mentlicher@netbeans.org
Log: #250307: The JDK bug was fixed in 1.8.0 update 60, therefore present severely shorted values only on updates less than 60.
Comment 11 Martin Entlicher 2015-10-27 14:10:43 UTC
*** Bug 256191 has been marked as a duplicate of this bug. ***