-
Notifications
You must be signed in to change notification settings - Fork 58
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
Question: Is there memory leak in jsPanel4? #121
Comments
@johacode You might be correct, please see #99 I didn't look at your fiddle yet. But will do ... and thanks a lot for your effort! |
@johacode |
Thanks for fast response. Yes, it looks like there is not seen detached elements anymore if panel is created with resizeit and dragit disabled.
|
After some more investigation my best guess is that event listeners added in rows 2213 and 3332 are preventing garbage collection after jsPanel is removed from DOM.
|
You're right. I could "fix" it already for the dragit interaction. Resizable seems more complicated though ... working on it ... |
Well, the first fix worked only in FF, not in other browsers. |
Hello there! I just started using you library this week and am quite impressed. Fixing memory leaks however is not fun. What's the status on this? Did you ever get around to revise the code in regards to this? I am going to integrate your lib for a demo project anyway, but would like to use it in the future and maybe I can help. |
@xnopasaranx Regards, |
@johacode |
I am using Chrome 83.0.4103.106 at the moment. Your changes seems to reduce the leakage a bit. It looks like jspanel-v4.11.0-beta.2 does reduces occurance of 'detatched EventListeners and V8EventListeners' from 25 to 20 . I did checked that EventListeners that are left in memory are referring to following places jsPanel.js:4496 (in self.sizeit function) |
@johacode |
@johacode @xnopasaranx |
@johacode @xnopasaranx To give it a try download alpha.jspanel.de/downloads/jspanel-4.11.3-alpha.zip I would highly appreciate some feedback ... 😏 |
Sorry that my response take couple of day but I have been busy with other things. Current version of Chrome I am using is 87.0.4280.88 (64 bit). I checked how original test case works that Chrome browser with the versions 4.10.0 (original), 4.11.2 and 4.11.3-alpha of jsPanel Here is new picture containing memory pains of Chrome. Notice that picture is such wide that all it shown with scrollbar on bottom. Screen capture from all detached elements with three jsPanel version It looks like 4.11.2 have least detached elements. Here is one blog post I found useful. description for shallow and retained sizes There I found these descriptions Shallow size Retained size |
With v4.11.3 I could improve this issue a little bit more. But that's probably as good as I can make it until I completely recode the dragit/resize code ... |
Hey @Flyer53, great project! I've forked the repo and implemented a fix for these memory leaks by using an abort signal to detach the events on the document and window when the panel is closed. I was hoping to test it out and send a pull request (assuming it works). I can't figure out how to build the project. I assume I am missing something obvious, could you give me some advice on how to build it? |
Hi @bmbabcock , Sorry for the late answer. Couldn't you just modify the source file and mail it to me? Then I'll check it out. Although I know about these memory leaks, so far nobody reported any real problem with that and I don't consider it as a real problem. Did you observe any real problem? Info: |
Hey @Flyer53, I've sent an email to the info address on your site and also attached a copy here. We use the library in a large application and a large number of panels are opened and closed while the application is in use. These panels contain forms some of which are quite extensive. This results in large chunks of detached HTML being retained in the heap. I expect our usage isn't typical but we see significant improvements with the change. I can't give you exact numbers because part of the panels were also retained by a second part of our code base. With the full panels now being garbage collected we have seen memory improvements from 1.5-2gb to ~0.5GB. |
@bmbabcock Almost all jsPanel use cases I know of are in some kind of backend or otherwise access restricted. So, to be frank, I don't know very much about how it's actually used. And feedback is quite sparse until a problem comes up. |
@johacode @xnopasaranx |
First of all your jsPanel library is very good library! Thanks for it.
I am just started to learn memory leak studies. My question is there leaking memory when one jsPanle4 dialog at time is opened and closed two or more times?
For me it looks like there is memory leak.
I am using Memory pane of Google Chrome 80.0.3987.163 (64-bit) in Windows 10 for my studies.
jsPanel version I am using is
CSS: https://cdn.jsdelivr.net/npm/[email protected]/dist/jspanel.css
script: https://cdn.jsdelivr.net/npm/[email protected]/dist/jspanel.js
Steps to reproduce
These detached elements are not found after 1st open and close round but they appear after 2nd round and they continue to increase after that. Total increase is approximately 10kB in every following round.
For me it looks like those elements are not garbage collected because global 'elmt' variable does have reference to them. Screen capture from one detached element
This is the point I have manged to study this issue so far.
The text was updated successfully, but these errors were encountered: