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.
After an opened project is closed its MainClassUpdater instance keeps hanging around. However, all I see in OptimizeIt is a reference path through WeakListenerImpl$PropertyChange to ProjectProperties: MainClassUpdater <- element of ArrayList <- elementData of WLI$PropertyChange <- listeners of PropertyUtils$SequentialPropertyEvaluator <- standardPropertyEvaluator of ProjectProperties <-... I don't see any direct hard reference. Investigation of the code at J2SEProject$ProjectOpenedHookImpl.projectOpened() (J2SEProject.java:361) does not reveal any local variable holding a reference to it either. Petre, could you please have a look at this in INSANE? Maybe you'll find a reference path OptimizeIt does not show me.... Thanks.
Here is the reference chain: org.netbeans.modules.project.ui.OpenProjectList.INSTANCE-> org.netbeans.modules.project.ui.OpenProjectList@f5b-> java.util.ArrayList@279f-> [Ljava.lang.Object;@41c7-> org.netbeans.modules.java.j2seproject.J2SEProject@715c-> org.netbeans.spi.project.support.ant.PropertyUtils$SequentialPropertyEvaluator@cdaa-> [Lorg.netbeans.spi.project.support.ant.PropertyProvider;@147f6-> org.netbeans.spi.project.support.ant.ProjectProperties$UserPropertiesProvider@c9b2-> org.netbeans.spi.project.support.ant.PropertyUtils$FilePropertyProvider@26ed-> java.util.ArrayList@3f20-> [Ljava.lang.Object;@6d84-> org.netbeans.spi.project.support.ant.ProjectProperties$UserPropertiesProvider@c9b3-> org.netbeans.spi.project.support.ant.ProjectProperties@dee9-> org.netbeans.spi.project.support.ant.PropertyUtils$SequentialPropertyEvaluator@dedc-> java.util.ArrayList@155e8-> [Ljava.lang.Object;@1c1e4-> org.netbeans.modules.java.j2seproject.MainClassUpdater@238d0 Not only MainClassUpdater is kept but also a bunch of other objects including the J2SEProject: org.netbeans.modules.project.ui.OpenProjectList.INSTANCE-> org.netbeans.modules.project.ui.OpenProjectList@f5b-> java.util.ArrayList@279f-> [Ljava.lang.Object;@41c7-> org.netbeans.modules.java.j2seproject.J2SEProject@715c-> org.netbeans.spi.project.support.ant.PropertyUtils$SequentialPropertyEvaluator@cdaa-> [Lorg.netbeans.spi.project.support.ant.PropertyProvider;@147f6-> org.netbeans.spi.project.support.ant.ProjectProperties$UserPropertiesProvider@c9b2-> org.netbeans.spi.project.support.ant.PropertyUtils$FilePropertyProvider@26ed-> java.util.ArrayList@3f20-> [Ljava.lang.Object;@6d84-> org.netbeans.spi.project.support.ant.ProjectProperties$UserPropertiesProvider@c9b3-> org.netbeans.spi.project.support.ant.ProjectProperties@dee9-> org.netbeans.spi.project.support.ant.AntProjectHelper@813d-> org.netbeans.api.project.ProjectManager$ProjectStateImpl@dee5-> org.netbeans.modules.java.j2seproject.J2SEProject@8139 It seems to me that the problem is sharing the user properties.
OPL should not hold a ref to the prj when the prj is closed.
It does not. According to Petr Nejedly he had two projects unrelated projects. He kept one open (the one referenced from OPL) and opened and closed the other one. The second one seems to be hold in memory through some listener on ProjectProperties.
Forgotten WeakListeners usage, I think.
committed * Up-To-Date 1.24 ant/project/src/org/netbeans/spi/project/support/ant/PropertyUtils.java committed * Up-To-Date 1.14 ant/project/test/unit/src/org/netbeans/spi/project/support/ant/PropertyUtilsTest.java Found a fixed one leak, please verify that this fixed the problem or file a new issue with a new leak chain.
The closed project is still referenced: org.netbeans.modules.project.ui.OpenProjectList.INSTANCE-> org.netbeans.modules.project.ui.OpenProjectList@1475-> java.beans.PropertyChangeSupport@2e5d-> java.util.Vector@4ae8-> [Ljava.lang.Object;@839c-> org.netbeans.modules.project.ui.actions.RecentProjects@dcf2-> javax.swing.JMenu@151f8-> javax.swing.JPopupMenu@1c0e1-> [Ljava.awt.Component;@24379-> javax.swing.JMenuItem@2e8cf-> java.util.Hashtable@34d29-> [Ljava.util.Hashtable$Entry;@38a89-> java.util.Hashtable$Entry@3b379-> org.netbeans.modules.java.j2seproject.J2SEProject@7e96 Strange that Insane haven't found this shorter reference chain before. A newly introduced leak? Reassigning to phrebejk.
Yet another reference fixed. Let's see what will come next. Please verify. Checking in projectui/src/org/netbeans/modules/project/ui/actions/RecentProjects.java; /cvs/projects/projectui/src/org/netbeans/modules/project/ui/actions/RecentProjects.java,v <-- RecentProjects.java new revision: 1.9; previous revision: 1.8 done
Finally fixed now.
Disagree. You perhaps fixed something else than what this issue originally was about. :) I still see cumulating instances of MainClassUpdater when I repeatedly open and close a project. The reduced reference graph in OptimizeIt just shows one reference path. Seee the attached screenshot.
Created attachment 18454 [details] MainClassUpdater instances not disposed
It was OK for my test case. Anyway, Projects can hardly fix the reference chain you posted, as the source file from the project is held by MDR. How much are they accumulating? How is the accumulation affected by the size of the AST cache?
Please insane it again with petr and if assign to who ever maintains the code holding that object. Thanks
Setting back to FIXED. The instances are hagning there only temporarily.
Verified.