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 225474 - Memory consumption of CndTextIndex
Summary: Memory consumption of CndTextIndex
Status: VERIFIED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 7.3
Hardware: All All
: P3 normal (vote)
Assignee: Alexander Simon
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2013-01-29 13:36 UTC by Alexander Simon
Modified: 2013-03-18 15:51 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
YourKit report (1.30 KB, text/plain)
2013-01-29 13:47 UTC, Alexander Simon
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Simon 2013-01-29 13:36:12 UTC
CND text index is buffered in internal array that is written with delay on disk.
Writing task is rescheduled.
In fact the array can be huge while parsing.
For example memory snapshot of 50% parsing Mozilla browser has 28M in StoreQueueEntry.
Probably periodical writing of the array can reduce memory footprint.

The second waste of memory is:
APTIndexingWalker produces IDs as CharSequence.
But APTIndexingWalker converts CharSequence ID to String.
Storing IDs as CharSequence can reduce size of the intermediate array at least in 2-3 times. Convert CharSequence to string just before writing in CndTextIndexImpl.store().
Comment 1 Alexander Simon 2013-01-29 13:47:59 UTC
Created attachment 130785 [details]
YourKit report
Comment 2 Vladimir Voskresensky 2013-01-30 07:33:37 UTC
Thanks Alexander!
Comment 3 Alexander Simon 2013-01-30 08:58:56 UTC
Also heap has a lot of duplicated strings. For example macro name "NS_DECLARE_STATIC_IID_ACCESSOR" has 733 duplicates in the index queue.
Comment 4 Alexander Simon 2013-01-31 08:58:34 UTC
store char sequences in intermediate array:
http://hg.netbeans.org/cnd-main/rev/12a5c76ae223
Now 3394 instances of StoreQueueEntry consumes 10,085,072 bytes on 50% parsing Mozilla browser
Comment 5 Vladimir Voskresensky 2013-01-31 10:43:41 UTC
thanks, Alexander. You fix is enough.
Comment 6 Alexander Pepin 2013-03-13 14:45:47 UTC
can not be easily verified
Comment 7 Egor Ushakov 2013-03-18 15:51:43 UTC
the fix is in releases branch:
http://hg.netbeans.org/releases/rev/ae12f8d1513b