Skip to content
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

Periodical memory usage spikes #304

Closed
kotyhoroshko2 opened this issue Sep 11, 2019 · 8 comments
Closed

Periodical memory usage spikes #304

kotyhoroshko2 opened this issue Sep 11, 2019 · 8 comments

Comments

@kotyhoroshko2
Copy link

Actual behavior

Occasionally, memory usage by WebExtensions process starts growing rapidly. It takes about 30 seconds to reach the peak at ~2 GB and then it quickly gets back to normal.
I managed to screenshot about:memory page at the peak usage. It looks like the memory is used by Temporary Containers addon.

Знімок екрану з 2019-09-11 11-30-20

Expected behavior

The addon should not consume unreasonably high amounts of memory.

Steps to reproduce

  1. Launch Firefox.

It does not seem that there is a user action that triggers it. I remember it happened once while the browser was not in focus at all.

@stoically
Copy link
Owner

Thanks for the report. I've actually never actively monitored the memory usage of TC since I'm not sure what could cause such an issue, because the only "expensive" thing happening in intervals is container cleanup, which checks for every TC if it still has tabs and removes the container if there aren't any tabs anymore. I've tested with 100 tabs but the container cleanup doesn't show any additional memory usage. I'll keep an eye on about:performance to see if I can catch the memory usage spike.

Two questions:

  • Did you monitor about:performance as well to make sure it's TC consuming the memory?
  • Do you have a lot of tabs open when it happens?

@stoically
Copy link
Owner

Monitored about:performance for the last 8 hours and memory usage stayed at 2.3 MB all the time, so unfortunately I'm not able to reproduce.

@kotyhoroshko2
Copy link
Author

Did you monitor about:performance as well to make sure it's TC consuming the memory?

I have just checked about:performance but it does not report high memory usage by TC while the issue happens. I could see high CPU usage though:

about:performance screenshot

I think I have an explanation of this. Previously I noticed that manually invoking garbage collection ("GC" button in about:memory) makes the memory usage by WebExtensions process almost instantly go back to normal for a moment. (But then it continues to grow.)
I believe that that means that all of those allocations are temporary objects, which get unreferenced immediately and thus cannot be attributed to any page/add-on.

Do you have a lot of tabs open when it happens?

Yes. Many more than 100.

Also, on the screenshot in my first message it is possible to see that a big part of that memory is multiple copies of URL-encoded images (mostly icons). I would guess that those might be clones of tabs.Tab.favIconUrl field.

@stoically
Copy link
Owner

Interesting. 13.5 MB memory is already unusually high - and I can see how GC might be the reason for about:performance not showing the memory, though, if about:memory reports it accurately for the given extension, it should also be shown on about:performance.

Just to make sure: TC has the Internal UUID 00f4cffb-4a9b-412f-9347-8eba9ab427e4 in your Firefox? You can check on about:debugging#/runtime/this-firefox (the Internal UUID is unique per installation).

Would you mind providing a debug log for the time frame when the issue happens?

@stoically
Copy link
Owner

And what's your average memory usage from TC without the issue?

@kotyhoroshko2
Copy link
Author

TC has the Internal UUID 00f4cffb-4a9b-412f-9347-8eba9ab427e4 in your Firefox?

Yes
about:debugging screenshot

And what's your average memory usage from TC without the issue?

On fresh start was is 2.5 MB.
After some usage it went to 3.8 MB.
Then the issue happened and it jumped to ~14 MB.
Then it went back to 3.7 MB.

I will try to collect more info.

@stoically
Copy link
Owner

Did some refactoring regarding container cleanup in #305 and published as v1.4, it doesn't use browser APIs in intervals at all anymore. So hopefully that addresses the memory spike as well. Please let me know if it pops up again.

@accountForIssues
Copy link

I am facing this issue since a week or two.

Firefox 116.0.3 (could have been in earlier versions as well)

I rarely keep any tabs open and usually delete containers on my own as well once I'm done.

Recently, I started noticing my memory usage going very high especially when I'm not using the browser. Once it got to 99% and my OS started killing other processes.

As soon as I start using the browser or open and close a new tab, the usage resets to normal values. It was even difficult to take this screenshot as it immediately reset the high usage.

settings - temporary_containers_preferences_2023-08-29_15.17.56.json.txt

The screenshot was taken when 3-4 containers were present. However, no tabs except one about:preferences were open.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants