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 99331

Summary: Profiling memory usage incorrectly indicates memory leak
Product: profiler Reporter: thomas_connolly <thomas_connolly>
Component: BaseAssignee: issues@profiler <issues>
Status: VERIFIED DUPLICATE    
Severity: blocker    
Priority: P1    
Version: 5.x   
Hardware: All   
OS: Windows XP   
URL: http://issues.apache.org/jira/browse/LUCENE-842
Issue Type: DEFECT Exception Reporter:

Description thomas_connolly 2007-03-29 01:42:13 UTC
Profiling memory usage incorrectly indicates memory leak.

While profiling an application recently I discovered an issue where the profiler
indicated a memory leak. However on further examination via a unit test the
memory usage was constant. 

I originally raised this case against the search library lucene (see the
reported error at http://issues.apache.org/jira/browse/LUCENE-842). 
There is a code example in that report TestParallelMultiSearcherMemLeak.java
which requires the library lucene-core-2.1.0.jar (available at
http://lucene.apache.org/java/docs/releases.html).

Running the unit test shows constant memory usage however running with-in the
profile exhausts maximum heap memory setting with an OutOfMemory exception.

I believe the problem may result from the use of joined threads in the lucene
code file ParallelMultiSearcher.java (see lucene code src download). If using
the sequential MultiSearcher.java the leak does not manifest.
Comment 1 Tomas Hurka 2007-03-29 10:22:02 UTC
Does the test involves creating a lot of new threads? I guess so based on the test name 
TestParallelMultiSearcherMemLeak, but I am not sure.
Comment 2 thomas_connolly 2007-03-30 06:28:28 UTC
In the example TestParallelMultiSearcherMemLeak it is actually only creating a
one thread (controlled by the variable N_INDEXES). However the the code file
ParallelMultiSearcher.java essentially N_INDEXES treads are created and started.
Basically the logic is as follows;
* Create N threads
* Start each thread running
* For each thread join (wait for each to die).

Comment 3 Tomas Hurka 2007-03-30 08:32:28 UTC
OK, so it looks like you are having issue #95020. It is already fixed and there
is even patch for NetBeans Profiler 5.5.

*** This issue has been marked as a duplicate of 95020 ***
Comment 4 Alexander Kouznetsov 2007-08-31 13:38:15 UTC
Verified duplicate