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 174741 - Memory leak in ChildrenArray's map
Summary: Memory leak in ChildrenArray's map
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Nodes (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: t_h
URL:
Keywords: PERFORMANCE, RANDOM, TEST
Depends on:
Blocks:
 
Reported: 2009-10-16 12:16 UTC by Jaroslav Tulach
Modified: 2009-10-16 15:47 UTC (History)
0 users

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 Jaroslav Tulach 2009-10-16 12:16:52 UTC
While working hard on issue 174713, I am able to simulate occasional leak among projects. 

------------- ---------------- ---------------
Testcase: testGCProjects(org.netbeans.test.ide.MemoryValidationTest):        FAILED
Checking if all projects are really garbage collected Project:
private static java.util.Map org.netbeans.modules.project.ui.ProjectTab.tabs->
java.util.HashMap@1e1e008-table->
[Ljava.util.HashMap$Entry;@dc67ca-[1]->
java.util.HashMap$Entry@52eb1b-value->
org.netbeans.modules.project.ui.ProjectTab@537945-btv->
org.netbeans.modules.project.ui.ProjectTab$ProjectTreeView@26221e-visHolder->
org.openide.explorer.view.TreeView$VisualizerHolder@9772fe-map->
java.util.HashMap@544429-table->
[Ljava.util.HashMap$Entry;@389dd4-[13]->
java.util.HashMap$Entry@4db1ce-key->
org.openide.explorer.view.VisualizerChildren@1b0e229-snapshot->
org.openide.nodes.EntrySupport$Default$DefaultSnapshot@876693-holder->
org.openide.nodes.ChildrenArray@d8fa47-map->
java.util.WeakHashMap@1c0269-queue->
java.lang.ref.ReferenceQueue@e6d1f-head->
java.util.WeakHashMap$Entry@33b4a2-value->
java.util.LinkedList@16fdc09-header->
java.util.LinkedList$Entry@18ffcc0-next->
java.util.LinkedList$Entry@c3269f-element->
org.netbeans.modules.project.ui.ProjectsRootNode$BadgingNode@e4a05a-pair->
org.netbeans.modules.project.ui.ProjectsRootNode$ProjectChildren$Pair@16d8487-project->
org.netbeans.modules.java.j2seproject.J2SEProject@aa78ab
junit.framework.AssertionFailedError: Checking if all projects are really garbage collected Project:
private static java.util.Map org.netbeans.modules.project.ui.ProjectTab.tabs->
java.util.HashMap@1e1e008-table->
[Ljava.util.HashMap$Entry;@dc67ca-[1]->
java.util.HashMap$Entry@52eb1b-value->
org.netbeans.modules.project.ui.ProjectTab@537945-btv->
org.netbeans.modules.project.ui.ProjectTab$ProjectTreeView@26221e-visHolder->
org.openide.explorer.view.TreeView$VisualizerHolder@9772fe-map->
java.util.HashMap@544429-table->
[Ljava.util.HashMap$Entry;@389dd4-[13]->
java.util.HashMap$Entry@4db1ce-key->
org.openide.explorer.view.VisualizerChildren@1b0e229-snapshot->
org.openide.nodes.EntrySupport$Default$DefaultSnapshot@876693-holder->
org.openide.nodes.ChildrenArray@d8fa47-map->
java.util.WeakHashMap@1c0269-queue->
java.lang.ref.ReferenceQueue@e6d1f-head->
java.util.WeakHashMap$Entry@33b4a2-value->
java.util.LinkedList@16fdc09-header->
java.util.LinkedList$Entry@18ffcc0-next->
java.util.LinkedList$Entry@c3269f-element->
org.netbeans.modules.project.ui.ProjectsRootNode$BadgingNode@e4a05a-pair->
org.netbeans.modules.project.ui.ProjectsRootNode$ProjectChildren$Pair@16d8487-project->
org.netbeans.modules.java.j2seproject.J2SEProject@aa78ab
        at org.netbeans.junit.NbTestCase.assertGC(NbTestCase.java:1312)
        at org.netbeans.junit.NbTestCase.assertGC(NbTestCase.java:1251)
        at org.netbeans.junit.Log$InstancesHandler.assertGC(Log.java:414)
        at org.netbeans.junit.Log.assertInstances(Log.java:237)
        at org.netbeans.test.ide.WatchProjects.assertProjects(WatchProjects.java:196)
        at org.netbeans.test.ide.IDEValidation.testGCProjects(IDEValidation.java:1411)
        at org.netbeans.jellytools.JellyTestCase.runTest(JellyTestCase.java:180)
        at org.netbeans.junit.NbTestCase.access$200(NbTestCase.java:88)
        at org.netbeans.junit.NbTestCase$2.doSomething(NbTestCase.java:336)
        at org.netbeans.junit.NbTestCase$1Guard.run(NbTestCase.java:273)
        at java.lang.Thread.run(Thread.java:619)
Comment 1 Jaroslav Tulach 2009-10-16 12:25:59 UTC
The critical part imho is the reference through WeakHashMap's reference queue. This means that the key is eligible for 
being GCed, but only when somebody calls into the map. There is a method finalizeNodes in ChildrenArray which is 
supposed to do so, but either is was not called, or was called to early.

This is presumably no big leak, I reported it as P2 only because the test is part of commit-validation.
Comment 2 t_h 2009-10-16 15:47:16 UTC
core-main #857fd59619fa