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 91551 - Search and replace interns strings
Summary: Search and replace interns strings
Status: RESOLVED WONTFIX
Alias: None
Product: editor
Classification: Unclassified
Component: Search (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@editor
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2006-12-25 19:48 UTC by _ tboudreau
Modified: 2009-11-02 10:55 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ tboudreau 2006-12-25 19:48:27 UTC
Download the following file and copy it into an empty text file in NetBeans
http://www.census.gov/tiger/tms/gazetteer/zips.txt

Run the following regexp replacement on it:
"\w\w","(\w\w\w\w\w)","(\w\w)","(.*)".*(\n)
Z$1 ("$1", State.$2, "$3"),$4

You will encounter an out of memory error w/ message "Java heap size", but the
heap has not grown.  Setting PermSize to 384M before startup allows the
replacement to complete (takes about 15 minutes!).

I can only conclude that some or all of the file is being interned in the
process of replacement and runs out of perm gen space for the interned strings.
Comment 1 Miloslav Metelka 2007-01-11 19:40:33 UTC
That's rather large file.
We will need to run profiler to figure out where the possible performance/memory
improvements could be done.
I remember that there used to be an ineficiency in searching where we have used
doc.getText() as a CharSequence which grabbed the whole text from the document
into a String. I have double-checked that it's no longer true - the find now
uses DocumentUtilities.getText() at DocumentFinder:210 which is a "view" over
the document's text.
Setting TM to future preliminarily.
Comment 2 _ tboudreau 2007-01-12 10:25:23 UTC
Might be interesting to just instrument String.intern() and dump stack traces to
the console.  I don't know any other way you can run out of perm gen doing
something that isn't loading classes.  The culprit is probably one easily found
line of code.
Comment 3 Miloslav Metelka 2007-01-12 10:25:53 UTC
I've also verified that both in FindSupport and DocumentFinder there are no
String.intern() calls.
Actually in j.u.regex.Pattern there are some intern() calls in
    private Node family(boolean not, boolean singleLetter)
Not sure whether the code will reach that point but it may be checked by debugging.
Comment 4 Max Sauer 2008-11-13 10:32:17 UTC
It would be nice to have this functional efficiently. Lets focus next release.
Comment 5 Quality Engineering 2009-11-02 10:55:08 UTC
NetBeans.org Migration: changing resolution from LATER to WONTFIX