Change By: Tobias Mattsson (04/Jun/13 9:54 AM)
Description: When an app opens a modal dialog its component is added as a child to MagnoliaShell. When the app is closed the component remains there. None of the object instances referenced by the dialog can be garbage collected making this a memory leak. The leaked instances include the entire app and all its sub apps.

This also effects choose dialogs.

This also effects dialogs open in a sub app when the sub app is closed. Also shell modal dialogs must have this problem although I have not tested it.

Steps to reproduce:

Log in to Admincentral
Start the Pages app
Edit /demo-features/content-templates/article
Add a contact component
In the dialog that pops up click "Select new..."
Choose one of the contacts and save
Close the Pages app

Even though they're not displayed there's two modal dialogs in the component tree holding on to the closed Pages app.

The component tree after this is:

{noformat}
   info.magnolia.ui.admincentral.AdmincentralUI
     info.magnolia.ui.vaadin.magnoliashell.MagnoliaShell
       info.magnolia.ui.vaadin.dialog.Modal
         info.magnolia.ui.contentapp.choosedialog.WorkbenchChooseDialogView
           info.magnolia.ui.contentapp.browser.BrowserViewImpl
             com.vaadin.ui.CssLayout
               com.vaadin.ui.CssLayout
                 info.magnolia.ui.vaadin.grid.MagnoliaTreeTable
                   com.vaadin.ui.Label
                   com.vaadin.ui.Label
                   com.vaadin.ui.Label
                   com.vaadin.ui.Label
                   com.vaadin.ui.Label
                   com.vaadin.ui.Label
                   com.vaadin.ui.Label
                   com.vaadin.ui.Label
                   com.vaadin.ui.Label
                   com.vaadin.ui.Label
                   com.vaadin.ui.Label
               com.vaadin.ui.CssLayout
                 com.vaadin.ui.NativeButton
                 com.vaadin.ui.NativeButton
                 com.vaadin.ui.NativeButton
               com.vaadin.ui.TextField
       info.magnolia.ui.vaadin.dialog.Modal
         info.magnolia.ui.vaadin.dialog.BaseDialog
           info.magnolia.ui.vaadin.form.Form
             info.magnolia.ui.vaadin.form.Form$1
               info.magnolia.ui.vaadin.form.tab.MagnoliaFormTab
                 info.magnolia.ui.vaadin.form.FormSection
                   info.magnolia.ui.app.contacts.field.ContactTextAndButtonField
                     com.vaadin.ui.HorizontalLayout
                       info.magnolia.ui.form.field.TextAndButtonField
                         com.vaadin.ui.HorizontalLayout
                           com.vaadin.ui.NativeButton
                           com.vaadin.ui.TextField
                       info.magnolia.ui.app.contacts.field.ContactThumbnailField
                         com.vaadin.ui.HorizontalLayout
                           com.vaadin.ui.Image
                           com.vaadin.ui.Label
       info.magnolia.ui.vaadin.magnoliashell.viewport.AppsViewport
       info.magnolia.ui.vaadin.magnoliashell.viewport.ShellAppsViewport
         info.magnolia.ui.vaadin.applauncher.AppLauncher
{noformat}

To print the component graph I added this piece of code in AdmincentralUI.init()

{code}
        new Timer(true).scheduleAtFixedRate(new TimerTask() {
            @Override
            public void run() {
                System.out.println("== Vaadin component report");
                int n = 0;
                LinkedList<Component> stack = new LinkedList<Component>();
                stack.add(AdmincentralUI.this);
                while (!stack.isEmpty()) {
                    Component component = stack.removeFirst();
                    int depth = 0;
                    Component x = component;
                    while (x!= null) {
                        depth++;
                        x = x.getParent();
                    }
                    System.out.println(StringUtils.repeat("  ", depth) + " " + component.getClass().getName());
                    n++;
                    if (component instanceof HasComponents) {
                        HasComponents hc = (HasComponents) component;
                        for (Component next : hc) {
                            stack.addFirst(next);
                        }
                    }
                }
                System.out.println("Total components: " + n);
            }
        }, 30000, 10000);
{code} 
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira



----------------------------------------------------------------
For list details, see: http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to