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 228366 - OOME in org.netbeans.swing.outline.EventBroadcaster.getContiguousIndexBlocks
Summary: OOME in org.netbeans.swing.outline.EventBroadcaster.getContiguousIndexBlocks
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Outline&TreeTable (show other bugs)
Version: 7.3
Hardware: All All
: P2 normal (vote)
Assignee: Martin Entlicher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-08 10:08 UTC by mklaehn
Modified: 2013-06-03 01:10 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Stackdump of OOME (2.00 KB, text/plain)
2013-04-08 10:08 UTC, mklaehn
Details
Test application (2.44 KB, text/x-java-source)
2013-04-08 10:09 UTC, mklaehn
Details
Heapdump of testapplication created by -XX:+HeapDumpOnOutOfMemoryError (2.76 MB, application/octet-stream)
2013-04-08 10:11 UTC, mklaehn
Details
proposed patch (3.53 KB, patch)
2013-04-08 10:13 UTC, mklaehn
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description mklaehn 2013-04-08 10:08:41 UTC
Created attachment 133360 [details]
Stackdump of OOME

When using a OutlineView and adding a huge amount (10000+) of Nodes to it using one Children instance this OOME happens.

For test and analysis purposes we've tried to create a simplistic use case. See the attached java class and run it using a limited heap (192mb using 64bit jdk7). 

The problem we found is the memory inefficient way to determine and return the contiguous index blocks. The ArrayLists and Integer Objects used in the determination introduce an exorbitant memory and GC overhead.
The heapdump i will attach soon shows that the method getContiguousIndexBlocks had allocated approximately 170MB of data to get the contiguous index blocks of an int[] with a length of 10000. OOME was thrown while creating a new ArrayList.

The attached patch solves that problem while working with only the resulting list of contiguous index blocks.
Comment 1 mklaehn 2013-04-08 10:09:42 UTC
Created attachment 133361 [details]
Test application

please run with -Xmx192m on 64bit jdk7
Comment 2 mklaehn 2013-04-08 10:11:22 UTC
Created attachment 133362 [details]
Heapdump of testapplication created by -XX:+HeapDumpOnOutOfMemoryError
Comment 3 mklaehn 2013-04-08 10:13:11 UTC
Created attachment 133363 [details]
proposed patch
Comment 4 Martin Entlicher 2013-06-01 16:43:47 UTC
Thank you for the patch and description.
It's applied by changeset:   255366:de7ea296d898, slightly modified.
http://hg.netbeans.org/core-main/rev/de7ea296d898

I've also wrote a siple test http://hg.netbeans.org/core-main/rev/35e2df2b981b
Comment 5 Quality Engineering 2013-06-03 01:10:30 UTC
Integrated into 'main-golden', will be available in build *201306022301* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/de7ea296d898
User: mentlicher@netbeans.org
Log: #228366: Memory requirements of getContiguousIndexBlocks() are improved by a patch provided by mklaehn.