You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by "Jochen Kemnade (JIRA)" <ji...@apache.org> on 2012/06/15 12:25:42 UTC

[jira] [Created] (TAP5-1956) Tapestry.ZoneManager creates memory leaks

Jochen Kemnade created TAP5-1956:
------------------------------------

             Summary: Tapestry.ZoneManager creates memory leaks
                 Key: TAP5-1956
                 URL: https://issues.apache.org/jira/browse/TAP5-1956
             Project: Tapestry 5
          Issue Type: Bug
          Components: tapestry-core
    Affects Versions: 5.3.3
            Reporter: Jochen Kemnade
         Attachments: 0001-Fix-memory-leaks-with-Tapestry.ZoneManager.patch

The Tapestry.ZoneManager creates a circular reference between the DOM tree and the ZoneManager JS object. This circle is not broken when the element is removed from the DOM, so it will not be cleaned up.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (TAP5-1956) Tapestry.ZoneManager creates memory leaks

Posted by "Howard M. Lewis Ship (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13295795#comment-13295795 ] 

Howard M. Lewis Ship commented on TAP5-1956:
--------------------------------------------

Have you verified these leaks?  I did some work in 5.2 or 5.3 to address this; when Tapestry removes content from the DOM , it walks the removed DOM elements and clears the attached Tapestry object, and nulls any function properties it sees. That's supposed to break the cycle.
                
> Tapestry.ZoneManager creates memory leaks
> -----------------------------------------
>
>                 Key: TAP5-1956
>                 URL: https://issues.apache.org/jira/browse/TAP5-1956
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.3.3
>            Reporter: Jochen Kemnade
>              Labels: dom, memory_leak, patch, zone
>         Attachments: 0001-Fix-memory-leaks-with-Tapestry.ZoneManager.patch
>
>
> The Tapestry.ZoneManager creates a circular reference between the DOM tree and the ZoneManager JS object. This circle is not broken when the element is removed from the DOM, so it will not be cleaned up.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (TAP5-1956) Tapestry.ZoneManager creates memory leaks

Posted by "Jochen Kemnade (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13393681#comment-13393681 ] 

Jochen Kemnade commented on TAP5-1956:
--------------------------------------

> Have you verified these leaks?

Yes, I have verified them using Chrome's dev tools, especially analyzing heap dumps. Try for example a zone within an outer div. $T(zone).zoneManager is the Tapestry.ZoneManager for the zone. After calling T5.dom.purgeChildren(outerDiv), $T(zone).zoneManager should be reset but isn't. The cycle is still there.

> when Tapestry removes content from the DOM , it [...] clears the attached Tapestry object [...]

That's what I thought too, but apparently that is not the case, at least I cannot find the code that does it. Also, there isn't really a "Tapestry object" in and after T5.2, $T return's the Prototype Element storage and - frankly spoken - I don't trust Prototype to clean up after itself.
Maybe it would be sufficient to clear the storage in the T5.dom's purge function, but in fact I like the clean-up callback approach.
                
> Tapestry.ZoneManager creates memory leaks
> -----------------------------------------
>
>                 Key: TAP5-1956
>                 URL: https://issues.apache.org/jira/browse/TAP5-1956
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.3.3
>            Reporter: Jochen Kemnade
>              Labels: dom, memory_leak, patch, zone
>         Attachments: 0001-Fix-memory-leaks-with-Tapestry.ZoneManager.patch
>
>
> The Tapestry.ZoneManager creates a circular reference between the DOM tree and the ZoneManager JS object. This circle is not broken when the element is removed from the DOM, so it will not be cleaned up.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (TAP5-1956) Tapestry.ZoneManager creates memory leaks

Posted by "Jochen Kemnade (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13295658#comment-13295658 ] 

Jochen Kemnade commented on TAP5-1956:
--------------------------------------

The same leakage pattern can also be observed with other Tapestry JS classes such as Tapestry.FormEventManager, Tapestry.FieldEventManager, Tapestry.ErrorPopup and others. The clean-up hook approach could be used to fix them all.
                
> Tapestry.ZoneManager creates memory leaks
> -----------------------------------------
>
>                 Key: TAP5-1956
>                 URL: https://issues.apache.org/jira/browse/TAP5-1956
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.3.3
>            Reporter: Jochen Kemnade
>              Labels: dom, memory_leak, patch, zone
>         Attachments: 0001-Fix-memory-leaks-with-Tapestry.ZoneManager.patch
>
>
> The Tapestry.ZoneManager creates a circular reference between the DOM tree and the ZoneManager JS object. This circle is not broken when the element is removed from the DOM, so it will not be cleaned up.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (TAP5-1956) Tapestry.ZoneManager creates memory leaks

Posted by "Howard M. Lewis Ship (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13295795#comment-13295795 ] 

Howard M. Lewis Ship commented on TAP5-1956:
--------------------------------------------

Have you verified these leaks?  I did some work in 5.2 or 5.3 to address this; when Tapestry removes content from the DOM , it walks the removed DOM elements and clears the attached Tapestry object, and nulls any function properties it sees. That's supposed to break the cycle.
                
> Tapestry.ZoneManager creates memory leaks
> -----------------------------------------
>
>                 Key: TAP5-1956
>                 URL: https://issues.apache.org/jira/browse/TAP5-1956
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.3.3
>            Reporter: Jochen Kemnade
>              Labels: dom, memory_leak, patch, zone
>         Attachments: 0001-Fix-memory-leaks-with-Tapestry.ZoneManager.patch
>
>
> The Tapestry.ZoneManager creates a circular reference between the DOM tree and the ZoneManager JS object. This circle is not broken when the element is removed from the DOM, so it will not be cleaned up.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (TAP5-1956) Tapestry.ZoneManager creates memory leaks

Posted by "Jochen Kemnade (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/TAP5-1956?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jochen Kemnade updated TAP5-1956:
---------------------------------

    Attachment: 0001-Fix-memory-leaks-with-Tapestry.ZoneManager.patch

The attached fixes this using the following approach:
 * create a function T5.dom.addCleanupHook to add callbacks when an element is removed/purged
 * add a clean-up hook to the Zone element that breaks the circular reference
                
> Tapestry.ZoneManager creates memory leaks
> -----------------------------------------
>
>                 Key: TAP5-1956
>                 URL: https://issues.apache.org/jira/browse/TAP5-1956
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.3.3
>            Reporter: Jochen Kemnade
>              Labels: dom, memory_leak, patch, zone
>         Attachments: 0001-Fix-memory-leaks-with-Tapestry.ZoneManager.patch
>
>
> The Tapestry.ZoneManager creates a circular reference between the DOM tree and the ZoneManager JS object. This circle is not broken when the element is removed from the DOM, so it will not be cleaned up.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (TAP5-1956) Tapestry.ZoneManager creates memory leaks

Posted by "Jochen Kemnade (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13393681#comment-13393681 ] 

Jochen Kemnade commented on TAP5-1956:
--------------------------------------

> Have you verified these leaks?

Yes, I have verified them using Chrome's dev tools, especially analyzing heap dumps. Try for example a zone within an outer div. $T(zone).zoneManager is the Tapestry.ZoneManager for the zone. After calling T5.dom.purgeChildren(outerDiv), $T(zone).zoneManager should be reset but isn't. The cycle is still there.

> when Tapestry removes content from the DOM , it [...] clears the attached Tapestry object [...]

That's what I thought too, but apparently that is not the case, at least I cannot find the code that does it. Also, there isn't really a "Tapestry object" in and after T5.2, $T return's the Prototype Element storage and - frankly spoken - I don't trust Prototype to clean up after itself.
Maybe it would be sufficient to clear the storage in the T5.dom's purge function, but in fact I like the clean-up callback approach.
                
> Tapestry.ZoneManager creates memory leaks
> -----------------------------------------
>
>                 Key: TAP5-1956
>                 URL: https://issues.apache.org/jira/browse/TAP5-1956
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.3.3
>            Reporter: Jochen Kemnade
>              Labels: dom, memory_leak, patch, zone
>         Attachments: 0001-Fix-memory-leaks-with-Tapestry.ZoneManager.patch
>
>
> The Tapestry.ZoneManager creates a circular reference between the DOM tree and the ZoneManager JS object. This circle is not broken when the element is removed from the DOM, so it will not be cleaned up.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (TAP5-1956) Tapestry.ZoneManager creates memory leaks

Posted by "Jochen Kemnade (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/TAP5-1956?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jochen Kemnade updated TAP5-1956:
---------------------------------

    Attachment: 0001-Fix-memory-leaks-with-Tapestry.ZoneManager.patch

The attached fixes this using the following approach:
 * create a function T5.dom.addCleanupHook to add callbacks when an element is removed/purged
 * add a clean-up hook to the Zone element that breaks the circular reference
                
> Tapestry.ZoneManager creates memory leaks
> -----------------------------------------
>
>                 Key: TAP5-1956
>                 URL: https://issues.apache.org/jira/browse/TAP5-1956
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.3.3
>            Reporter: Jochen Kemnade
>              Labels: dom, memory_leak, patch, zone
>         Attachments: 0001-Fix-memory-leaks-with-Tapestry.ZoneManager.patch
>
>
> The Tapestry.ZoneManager creates a circular reference between the DOM tree and the ZoneManager JS object. This circle is not broken when the element is removed from the DOM, so it will not be cleaned up.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (TAP5-1956) Tapestry.ZoneManager creates memory leaks

Posted by "Jochen Kemnade (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13295658#comment-13295658 ] 

Jochen Kemnade commented on TAP5-1956:
--------------------------------------

The same leakage pattern can also be observed with other Tapestry JS classes such as Tapestry.FormEventManager, Tapestry.FieldEventManager, Tapestry.ErrorPopup and others. The clean-up hook approach could be used to fix them all.
                
> Tapestry.ZoneManager creates memory leaks
> -----------------------------------------
>
>                 Key: TAP5-1956
>                 URL: https://issues.apache.org/jira/browse/TAP5-1956
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.3.3
>            Reporter: Jochen Kemnade
>              Labels: dom, memory_leak, patch, zone
>         Attachments: 0001-Fix-memory-leaks-with-Tapestry.ZoneManager.patch
>
>
> The Tapestry.ZoneManager creates a circular reference between the DOM tree and the ZoneManager JS object. This circle is not broken when the element is removed from the DOM, so it will not be cleaned up.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira