Vaadin table-> add, remove, add table -> Browser memory leak

Hello,
I observed serious memory leak in Vaadin 6.8.9 table- it will be never deallocated objects on browser side.
Steps to reproduce:
25x add&remove new Table() on Layout.
Result:
java heap seeems to be OK, there max 1 Object table
Chrome heap: There is 25 objects VScrollTable_0 and another children.

Code:


package cz.trask.monitor.console.vaadin.ddlayout;

import com.vaadin.Application;
import com.vaadin.ui.Button;
import com.vaadin.ui.CssLayout;
import com.vaadin.ui.Table;
import com.vaadin.ui.Window;

/**
 * The Application's "main" class
 */
@SuppressWarnings("serial")
public class WidgetTestApplication extends Application {

    private Window window;
    private final CssLayout layout = new CssLayout();
    private final Button b = new Button("toogle", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            toogleNewGrid();
        }
    });

    @Override
    public void init() {
        window = new Window("Widget Test");
        setMainWindow(window);
        window.addComponent(b);
        window.addComponent(layout);
    }

    private void toogleNewGrid() {
        layout.removeAllComponents();
        layout.addComponent(new Table());
    }
}

Java memory screenshot:

Chrome memory

Is it feature or bug?
Is it known?
Will be that bug fixed in 6.x branch and probably when?
Thank you

ticket http://dev.vaadin.com/ticket/11441

The problem seems to be in VScrollTable
There is reqistred close contextmenu handler, which is not unregistred after table detach


public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
rendering = true;

// On the first rendering, add a handler to clear saved context menu
// details when the menu closes. See #8526.
if (this.client == null) {
client.getContextMenu().addCloseHandler(
new CloseHandler<PopupPanel>() {
public void onClose(CloseEvent<PopupPanel> event) {
contextMenu = null;
}
});
}

This handler has pointer to table by:
contextMenu = null;
which probably means VScrolltable.this.contextMenu…

I tried to create patch file (save pointer to handler and unregister it on detach)


+ 
+ ////////////////////////////////////////////////////////////////////////////
+ //////////////pprikryl@trask.cz memory leak PATCH #11441////////////////////
+ ////////////////////////////////////////////////////////////////////////////
+ ////////////////////////////// BEGIN ///////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////
+ HandlerRegistration closeContextMenuHandler = null;
+ 
+ @Override
+ protected void onUnload() {
+ if(closeContextMenuHandler != null){
+ closeContextMenuHandler.removeHandler();
+ }
+ super.onUnload();
+ }
+ 
/*
* (non-Javadoc)
* 
@@ -874,12 +902,16 @@
// On the first rendering, add a handler to clear saved context menu
// details when the menu closes. See #8526.
if (this.client == null) {
- client.getContextMenu().addCloseHandler(
+ closeContextMenuHandler = client.getContextMenu().addCloseHandler(
new CloseHandler<PopupPanel>() {
public void onClose(CloseEvent<PopupPanel> event) {
contextMenu = null;
}
});
+ ////////////////////////////////////////////////////////////////////////////
+ /////////////////////////////// END ////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////
}
// If a row has an open context menu, it will be closed as the row is
// detached. Retain a reference here so we can restore the menu if