[jboss-jira] [JBoss JIRA] Created: (JBRULES-426) Memory leak in RuleHelperActionDelegate

Kris Verlaenen (JIRA) jira-events at jboss.com
Tue Aug 15 18:04:21 EDT 2006


Memory leak in RuleHelperActionDelegate
---------------------------------------

                 Key: JBRULES-426
                 URL: http://jira.jboss.com/jira/browse/JBRULES-426
             Project: JBoss Rules
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: Eclipse IDE
            Reporter: Kris Verlaenen
         Assigned To: Kris Verlaenen
             Fix For: 3.0.4


The class RuleHelperActionDelegate ( svn)  has a memory leak. Specifically:

the Delegate itself is responsible for deleting any and all created Menu widgets. In the current implementation, the getMenu(Control) method is as follows:


       Menu menu = new Menu( parent );
        final Shell shell = parent.getShell();
        addProjectWizard( menu, shell ); 
       addRuleWizard( menu,shell );
        addDSLWizard( menu, shell );
        addDTWizard( menu,shell );        
        return menu;

Clearly, new menu widgets are created each time and are never disposed of. A correct implementation of this interface is available at org.eclipse.wst.server.ui.internal.webbrowser.SwitchBrowserWorkbenchAction . Specifically, the getMenu(Control) method should first dispose of the last menu, then create the new ones. 

    public Menu getMenu(Control parent) {
        setMenu(new Menu(parent));
        //fillMenu(fMenu); 
        initMenu();
        return fMenu;
    }

    private void setMenu(Menu menu) {
        if (fMenu != null) {
            fMenu.dispose();
        }
        fMenu = menu;
    }


So... ... ... he needs to destroy his menus before creating new ones =]

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list