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 41790

Summary: Show All Details action can easily end up with OutOfMemoryError
Product: utilities Reporter: Antonin Nebuzelsky <anebuzelsky>
Component: SearchAssignee: Marian Petras <mpetras>
Status: RESOLVED FIXED    
Severity: blocker CC: issues
Priority: P2 Keywords: PERFORMANCE
Version: 5.x   
Hardware: Sun   
OS: Solaris   
Issue Type: DEFECT Exception Reporter:
Attachments: exc trace

Description Antonin Nebuzelsky 2004-04-07 13:26:31 UTC
Show All Details action can easily consume all
available heap ending with OutOfMemoryError.

Simply create a large result set of Find in Files,
e.g. by searching for "core" word in nb_all/core
directory. So far so good. The memory consumption
at this moment is reasonable, memory meter shows 26MB.

Click Show All Details and wait a while. The
action tries to populate Output window with
entries for all the found occurences and quickly
consumes all of the 96MB of heap space. After
closing the exception dialog you can clear the
output window and decrease the heap usage back to
where it was.

This action should be able to prevent
OutOfMemoryError by detecting the issue early and
stopping before all heap is consumed, or by
limiting the output size some way...
Comment 1 Marian Petras 2004-04-07 13:28:59 UTC
Accepted.
Comment 2 Marian Petras 2004-07-08 15:40:37 UTC
It is not possible to substantially reduce memory consumption for the
sole operation Show All Details without breaking API compatibility.

So we will limit the size of a result set to maximum 500 found nodes.
Comment 3 Marian Petras 2004-07-08 15:45:34 UTC
Fixed in the trunk.

Number of found objects is limited now - when 500 objects are found,
searching is stopped and a the root node of the Search Results window
contains a message that searching was stopped.

The message needs to be polished.
Comment 4 Marian Petras 2004-07-08 15:47:08 UTC
Modified files:
   utilities/src/org/netbeans/modules/search/Bundle.properties   (1.26)
   utilities/src/org/netbeans/modules/search/ResultModel.java   (1.40)
   utilities/src/org/netbeans/modules/search/SearchTask.java   (1.8)
Comment 5 Max Sauer 2005-07-19 14:24:32 UTC
On my mashine, the out of memory excetion pops up when showing details for a 500
entries search result. Please either lower the limit or find out another solution.

Steps to reproduce:
1)Search DebuggerJDPA for "a"
2)After it reaches the 500 limit, invoke Show All Details

result: exception is thrown, somtimes nothing is displayed in the output.

---------------------------
Solaris 10 running on Sparc
dev200507181000
JDK 1.5.0_01

Comment 6 Max Sauer 2005-07-19 14:25:29 UTC
Created attachment 23158 [details]
exc trace
Comment 7 Marian Petras 2005-09-13 15:22:55 UTC
Fixed in the trunk.

I made a change such that not only number of found nodes is limited (limit 500)
but also number of found occurences is limited (limit 5000). If either of these
limits is reached, the search is stopped.

Modified files:
    /utilities/src/org/netbeans/modules/search/:
                                            ResultModel.java
                                            ResultTreeChildren.java
                                            Bundle.properties
    /utilities/src/org/netbeans/modules/search/types/:
                                            FullTextType.java

Diffs:
http://utilities.netbeans.org/source/browse/utilities/src/org/netbeans/modules/search/ResultModel.java?r1=1.49&r2=1.50&diff_format=u
http://utilities.netbeans.org/source/browse/utilities/src/org/netbeans/modules/search/ResultTreeChildren.java?r1=1.12&r2=1.13&diff_format=u
http://utilities.netbeans.org/source/browse/utilities/src/org/netbeans/modules/search/Bundle.properties?r1=1.32&r2=1.33&diff_format=u
http://utilities.netbeans.org/source/browse/utilities/src/org/netbeans/modules/search/types/FullTextType.java?r1=1.49&r2=1.50&diff_format=u