Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Managing Node's memoryleaks with a node:destroy event #568

Open
ItsAsbreuk opened this issue Mar 30, 2013 · 0 comments
Open

Managing Node's memoryleaks with a node:destroy event #568

ItsAsbreuk opened this issue Mar 30, 2013 · 0 comments
Labels

Comments

@ItsAsbreuk
Copy link

Actually, this is a whole picture of managing memoryleaks related to Node.

It also consists issues
#547
#549
#560
#551

which can be closed if you fulfill this ticket in some way.

The proposal consist of 4 steps to be made:

  1. introduce the node:destroy event
    Node.destroy() should fire a node:destroy event.
    Node.removeChild(childnode) should fire a node:destroy event for childnode.
    Node.replaceChild(node, refnode) should fire a node:destroy event for refnode.

Also, Node.load, Node.setHTML, Node.remove and Node.replace are safe now, because -under the hood- they use some of the three method mentioned before.

  1. Make the eventsystem in a way that all events are listening to the node:destroy event by themself. Once they catch such an event: they need to look up in the domstructure whether the node that fired the node:destroy-event is a parentNode of the Node it was bound to itself. If so: the eventlistener should destroy itself (detach). This way, none of the Node-methods need to have recursive option anymore!

  2. Make Widgets standard listen to node:destroy by design. Once they catch such an event: they need to look up in the domstructure whether the node that fired the node:destroy-event is a parentNode or if its the widgets-boundingBox. If so: the widget should destroy itself.

  3. Define a YUI_config option 'memorySafe' which takes care of Node._instances to do a cleanup when Y.on('node:destroy') is fired. The cleanup should exists of cleaning the Node._instances with all references of the destoyed Node, as well as its children. Because this has a performancehit, 'memorySafe' should be made an option. Anyone who need speed can set this off while anyone who need a rocksolid app can set it on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant