[jbosside-dev] FW: Memory leak in DroolsIDE
Marshall Culpepper
marshall.culpepper at jboss.com
Mon Aug 14 20:41:52 EDT 2006
FYI Rob Stryker (our JBossAS adapter lead) has found a memory leak in the
DroolsIDE code:
On 8/14/06, Robert Stryker <rob.stryker at jboss.com> wrote:
>
> Hey Marshall:
>
> Please forward this over to the rules guy. I found a memory leak in his
> code.
>
> The class RuleHelperActionDelegate ( svn<http://anonsvn.labs.jboss.com/labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/menu/RuleHelperActionDelegate.java>)
> 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 =]
>
--
Marshall Culpepper
marshall.culpepper at jboss.com
JBoss Eclipse IDE Lead, JBoss Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jbosstools-dev/attachments/20060814/b3c6a37e/attachment.html
More information about the jbosstools-dev
mailing list