-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Memory leak when removing an element. #241
Comments
In order to illustrate this, I created a jsbin http://jsbin.com/bapuxo/2/edit, that if you click "Go", it will leak memory. |
@DmitryBaranovskiy Thank you for the fast fix. But I would suggest maybe a Ideas? |
This would make sense if Snap API was the only way user could interact with the DOM. What if whole |
@DmitryBaranovskiy Make sense, thanks. |
Doing a code search, I found that all elements created by Snap.svg are stored in a context variable
hub
:https://github.com/adobe-webplatform/Snap.svg/blob/master/dist/snap.svg.js#L838
No element are ever removed from
hub
, even ifelement.remove()
is called. Thus, if a large amount of objects are added and then removed, it will create a really bad memory leak as no element object, or the corresponding detached DOM element is freed from memory.Also since
hub
is a context variable created in a closure, I cannot release the object even manually.Please provide a method on Element object to remove the element from
hub
object and let GC to collect it.The text was updated successfully, but these errors were encountered: