-
Notifications
You must be signed in to change notification settings - Fork 158
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 hotTable's parent scope is destroyed. #157
Comments
I'm also having serious leakes because i destroy my controllers holding this directive. i tried adding what you said but I get this error when i toggled routes (in ui router)
|
👍 this directive needs to clean up after itself using the Right now we have to work around that by manually destroying hotInstance using the |
@armensg I tested the line of code I previously mentioned and I got a similar error. I don't remember under what circumstances it worked (just got back from holidays ^^) but there are other ways to solve this. Just as terite pointed out you have to destroy the hotInstance manually using hotRegisterer. I searched my code and It looks like what I ended up doing was creating another directive which you can add to
then:
|
@Ruffle0 actually I am not sure its working. I still have performance drop after and many events not getting removed. I modified the directive a bit to remove the post-mortem message.
|
would be useful if there as a function to remove event listeners from the page - since the destrory function is failing to do this. |
Did this ever get resolved? We're seeing something similar and it's keeping us from using handsontable. Shouldn't destroy() remove the event listeners explicitly? |
When the scope is destroyed or the DOM element is removed the Handsontable instance is destroyed. Issue: #157
Hi,
I often use the directive inside controllers whoose scope is later destroyed. I'm not an expert but it seems that, in this case, the elements are not properly removed from the DOM which causes a memory leak.
I discovered that, in the vanilla handsontable code, you can call the .destroy() method on a hot instance to remove it from the DOM so I added
element.on("$destroy", function() { scope.hotInstance.destroy(); });
at the end of hotTable's "compile" (line 584), which fixed the memory leak.
I don't know if this could break other parts of your code but I just wanted to let you know there's potential problem here.
The text was updated successfully, but these errors were encountered: