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 248538 - OOME: 1GB in strings via preferences
Summary: OOME: 1GB in strings via preferences
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Options&Settings (show other bugs)
Version: 8.0
Hardware: All All
: P2 normal (vote)
Assignee: Theofanis Oikonomou
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-10 12:03 UTC by eduarddrenth
Modified: 2015-09-11 01:23 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 213318


Attachments
stacktrace (907 bytes, text/plain)
2014-11-10 12:04 UTC, eduarddrenth
Details

Note You need to log in before you can comment on or make changes to this bug.
Description eduarddrenth 2014-11-10 12:03:58 UTC
Build: NetBeans IDE 8.0.1 (Build 201408251540)
VM: Java HotSpot(TM) 64-Bit Server VM, 24.45-b08, Java(TM) SE Runtime Environment, 1.7.0_45-b18
OS: Windows 7

User Comments:
eduarddrenth: keep netbeans running for some days with several projects open and actively use it




Stacktrace: 
java.lang.OutOfMemoryError: Java heap space
   at java.util.Arrays.copyOf(Arrays.java:2219)
   at java.util.ArrayList.grow(ArrayList.java:242)
   at java.util.ArrayList.ensureExplicitCapacity(ArrayList.java:216)
   at java.util.ArrayList.ensureCapacityInternal(ArrayList.java:208)
   at java.util.ArrayList.add(ArrayList.java:440)
   at org.netbeans.core.startup.preferences.NbPreferences.put(NbPreferences.java:193)
Comment 1 eduarddrenth 2014-11-10 12:04:00 UTC
Created attachment 150387 [details]
stacktrace
Comment 2 Jaroslav Tulach 2014-11-14 14:01:25 UTC
There is an array in NbPreferences

this (Java frame)     - value: java.util.ArrayList #521
 <- value     - class: java.util.HashMap$Entry, value: java.util.ArrayList #521
  <- [6]     - class: java.util.HashMap$Entry[], value: java.util.HashMap$Entry #40143
   <- table     - class: java.util.HashMap, value: java.util.HashMap$Entry[] #3255
    <- cachedKeyValues (Java frame)     - class: org.netbeans.core.startup.preferences.NbPreferences$UserPreferences, value: java.util.HashMap #6954

which has retained size 1GB! It contains 13M of elements. Mostly strings representing a number - possibly currentTimeMillis.
Comment 3 Theofanis Oikonomou 2015-09-10 08:50:11 UTC
Changeset: 6ad45f1e33cb
Author:    Theofanis Oikonomou <theofanis@netbeans.org>
Date:      2015-09-10 10:49
Message:
Comment 4 Theofanis Oikonomou 2015-09-10 08:53:02 UTC
The cache array was introduced to handle any delayed file events that would change some property to an old value. The cache's size is now retained to a logical value. Thank you
Comment 5 Quality Engineering 2015-09-11 01:23:41 UTC
Integrated into 'main-silver', will be available in build *201509110002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/6ad45f1e33cb
User: Theofanis Oikonomou <theofanis@netbeans.org>
Log: Task #248538 - OOME: 1GB in strings via preferences