-
Notifications
You must be signed in to change notification settings - Fork 88
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
Possible memory leak? #137
Comments
@francescozaniol thanks for reporting the issue, I will take a look 👍 |
Is this affecting only SPA? |
@zefexdeveloper yes this issue affects SPA mostly if you refresh the page the problem goes away. |
Thanks @ndelvalle , I'll have a look as soon as I can |
Hi @ndelvalle , I had a look at your example branch; actually in that example the detached nodes remain in memory because you're using console.log of "el" (file example/src/views/Home.vue); if you remove the console.logs (or you can just keep the strings) the memory snapshot remains clear from detached nodes. Can you confirm it too? |
Hi again @ndelvalle , good news: I made a build from the branch you created and placed it directly inside node_modules of my app, no more detached nodes and memory is drastically lower. I can confirm the issue is gone. Thanks, well done |
Wow, thanks @francescozaniol for helping me debug the problem 🙏🏻! I will update the tests according to the changes I made and push a new version tonight. |
v-click-outside 2.1.5 published 🎉 |
I should also do not expose the |
Hey @ndelvalle , sorry to bother you again with this but I'm still experiencing the issue. I've updated at 2.1.5 and I've had a look at a diff and I noticed you added a setTimeout, which seems to be the culprit. Was there a particular reason for that? removing it fixes the memory leak in my app. Let me know. |
Strange, @francescozaniol this was introduced at #42 I wonder if this still happens so we can remove it, or maybe we should tackle differently. I am also preparing a new version removing the |
@francescozaniol are you sure you are not saving the |
@ndelvalle I'll do some more testing asap and I'll let you know |
@ndelvalle after quite some testing, I've found out that the issue was indeed linked with the timeout, but only with elements populated by async data. In this scenario there were cases when the "unbind" function was run before the timeout function (for reasons I cannot still quite understand ..), therefore the event was added to a detached node, causing the memory leak. Check my PR, that commit fixes the issue (at least in my app) |
Installed v3.0.0 in my SPA, confirmed memory leak is gone. Thanks again @ndelvalle |
Hi, unless I'm doing something wrong, this extension seems to be causing a memory leak in my SPA vue app. To be more precise it seems that when an element with "v-click-outside" gets destroyed (by a route change) not all references to the doms are properly removed and they stay as "detached" elements in the memory. See the two imgs attached:
In this memory snapshot I've got 4645 detached elements, and all of them have v-click-outside in common. This causes memory to keep going up on every route change.
In the following screenshot I've removed the v-click-outside directive and I end up with just one detached elements, which seems to be keeping memory stable:
Am I missing something?
Thanks!
The text was updated successfully, but these errors were encountered: