Closed iosonopersia closed 4 years ago
Hi everyone! I updated my demo app to Yasgui version 4.0.120 As you can see by yourself, the problem is now completely fixed, thanks to your awesome work! Thank you so much for fixing this issue!
I think it would be perfect if documentation was updated explaining the use of destroy() function. Bye bye! 🎉🎉🎉
We were still busy verifying whether this fixed all memory issues (including yours), but good to hear it's resolved! :+1:
Hi everyone! I'm currently using the latest version of Yasgui in an Angular-based project. The Single Page Application approach makes the application de-allocate components when they're not used anymore. For example, when the user navigates to another view, each component of the first view gets destroyed.
I made a little demo project with two views. The second one contains an empty component, while in the first one there's a component which instantiates a Yasgui element.
The expected behavior: when YasguiPageComponent gets destroyed, its heap memory is ready for garbage-collection. The actual behavior: switching back and forth from one view to the other (and thus repeatedly instantiating and destroying Yasgui component) makes heap memory consumption go higher and higher.
You can have a look by yourself opening this demo web-app and using Developer Tools to keep an eye to the memory usage and maybe to track down the source of the leak. You just have to repeatedly click on the green button in the top of the page to switch between the two views.
I just wanted to warn you about this. I tried looking for the cause of the leak, maybe some reference to the instantiated objects is kept in the context of an event callback, or something like that. A method to remove all listeners attached by the library (and to clean instantiated objects) could become very useful in a single page application because I can intercept the destroy event of the component and execute it to prevent the memory leak.
Here you can find the source code of the demo web-app. Thank you in advance for your attention.