mozilla / memchaser

Firefox extension to chase the memory usage and garbage collector activity
https://wiki.mozilla.org/QA/Automation_Services/Projects/Addons/MemChaser
29 stars 23 forks source link

Request: Automatic Memory reduction #221

Closed rayman89 closed 9 years ago

rayman89 commented 9 years ago

Could you add the options for the add-on to automatically, after a defined by the user, time use the command to reduce memory and/or do garbage collection and/or do a cycle collection.

Also my garbage collection duration is always red and close to 1 second what does it mean and why is it "so slow" (i guess it's cause it's in red) and how can I fix it?

Thanks a lot for the add-onn and for taking your time to read this.

whimboo commented 9 years ago

I'm not sure how helpful the automatic clean-up would be, given that you might miss certain leaks. @amccreight what would you say about that? Is that useful?

Otherwise regarding the red numbers... Usually the ui should respond to user actions within 100ms at maximum. But if garbage collection happens and it stops ui updates for a longer time we display the numbers in red. I strongly feel that you experience a lot of sluggish behavior when working with Firefox. Is that correct?

To identify that a couple of tools are available, which I personally haven't used yet. @amccreight should also be able to help you out there, with maybe best a bug filed in Bugzilla.

rayman89 commented 9 years ago

As long as it's useful it doesn't need to be optimal IMO,

I have some performance issues on firefox but it shows more in peaks (firefox hangs for 1,5 ~ 2 secs sometimes) than a constant slowdown. Although problems start appearing a lot more frequently when the memory exceeds 1gb I'm usually at 800mb. I usually have sessions with 100+ tabs and use auto unload tab add-on to keep most of them unloaded. I have a rather beefy computer with 12 gb memory so hardware limitation wouldn't be the problem. I also use firefox x64 as the x32 version causes an out of memory crash instead of those hangs .

I would gladly hear any information that might help solve or deal with this performance issues or make them noticeable to mozilla dev team. Sadly for me I haven't been able to find a way nor a browser that can deal with 100+ tabs without mayor issues. Firefox with add-ons is the best alternative for me and i also prefer firefox cause of the freedom it has regarding customization.

Thanks for your time.

amccreight commented 9 years ago

We already run the GC or CC about every 5 seconds, so running it more probably isn't going to help. If you are manually running the GC in about:memory or something and it seems to help, then maybe there's a bug. Do you see any entries under ghost-windows in about:memory? Unfortunately in general it is hard to figure out what exactly can be improved in these situations where somebody has GC problems with many tabs and many addons. You could file a bugzilla bug and CC me and we could try to get more information to see if something could be improved. It sounds like the long pauses are the biggest issue for you.

rayman89 commented 9 years ago

Oh so the add-on does GC and CC automatically already? Does it do memory reduction as well? I don't run neither of the tree manually.

I currently have 5 entries on ghost windows but I didnt know about this before you mentioned so it's the first time I check. What does this mean?

10 (100.0%) -- ghost-windows ├───5 (50.00%) ── http://vodlocker.com/[...] [5] ├───2 (20.00%) ── http://disqus.com/embed/comments/[...] [2] ├───2 (20.00%) ── https://translate.googleusercontent.com/translate_c?[...] [2] └───1 (10.00%) ── http://watch-series-tv.to/open/cale/[...]

Yes the pauses are the Issue.

https://bugzilla.mozilla.org/show_bug.cgi?id=1177625

amccreight commented 9 years ago

No, Firefox itself regularly runs the GC and CC. No additional work should be required by the addon. The GC and CC try to free memory, but this won't always work. I'll comment in your bug about ghost windows.

rayman89 commented 9 years ago

Thanks.

The problem is that firefox advices against having more than 100 tabs open and discourages this kind of behaviour so IDK if this is a problem that can be solved by me or is that is just that firefox is not made for that kind of intensive use.

https://support.mozilla.org/en-US/kb/firefox-uses-too-much-memory-ram

"Each tab requires Firefox to store a web page in memory. If you frequently have more than 100 tabs open, consider using a more lightweight mechanism to keep track of pages to read and things to do"

amccreight commented 9 years ago

Having any ghost windows is going to result in a bad experience no matter how many tabs you may have open. Actually, it could be handy if memchaser indicated when you had a ghost window. It shouldn't be too hard to make it so that can be checked.

rayman89 commented 9 years ago

That would be nice. But how do you solve it? Do you have to restart the browser or are there any other ways?

If restarting firefox fixes almost all the problems regarding memory hangs etc wouldn't be a nice idea if firefox could do like "partial" resets of itself to allow to be kept open for long times without compromising the stability and performance?

amccreight commented 9 years ago

Restarting the browser will work. If we get good reproducible test cases, we can figure out the cause of the ghost windows, but that can be difficult. Multiprocess Firefox could eventually help with something like this, because the pages live in a separate process from all the UI stuff, so maybe you could restart it separately.

rayman89 commented 9 years ago

My main suspect was the unload tab add-on but i tried with a different profile with just the session manager and the unload tab add-on and tested it for a few mins opening and closing tabs but It doesn't happen.

My other suspect is hibernating as usually after hibernating firefox performance drops a lot and used to cause flash plugin to display the it's taking to long to respond alert once after each hibernation. I'll test this later. (EDIT: Noticed before hibernating that again got 5 ghost-windows so hibernating is not the cause

Edit2: I noticed that the ghost windows end up disappearing with time although new may appear(?) Also noticed this entry on about config memory.ghost_window_timeout_seconds does that mean that firefox automatically closes ghost windows?)

Have you checked the list of add-ons to see if anyone catches your attention regarding this issue?

whimboo commented 9 years ago

Having any ghost windows is going to result in a bad experience no matter how many tabs you may have open. Actually, it could be handy if memchaser indicated when you had a ghost window. It shouldn't be too hard to make it so that can be checked.

Filed as issue #224. Maybe you have some handy tips in how to best get this information?

whimboo commented 9 years ago

@rayman89 I wonder if we can get all related information of your troubles moved out to the newly created bug. All those are not related to memchaser but Firefox.

Also given that Firefox is doing regular CC/GC I wonder how useful this issue still is.

rayman89 commented 9 years ago

What about automatic "reduce memory" would that be useful or firefox also does that by itself?

amccreight commented 9 years ago

Firefox does everything it can to free memory already. :) You can click on "minimize memory usage" in about:memory which will do some freeing of stuff immediately. Generally, that should not have much of an effect.

whimboo commented 9 years ago

@amccreight I assume that we can close this issue? Looks like it's nothing memchaser could assist with.

amccreight commented 9 years ago

Yeah we should be doing this already in Firefox.

whimboo commented 9 years ago

Thanks!