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

Unexpected memory usage spike soon after launch #3231

Open
meldra opened this issue Sep 7, 2024 · 6 comments
Open

Unexpected memory usage spike soon after launch #3231

meldra opened this issue Sep 7, 2024 · 6 comments
Labels

Comments

@meldra
Copy link

meldra commented Sep 7, 2024

I installed the browser (Version 1.104.0 (251)) on my MBP 14" M1 (Sonoma 14.6.1 (23G93)) for the first time yesterday to check it out, which I've been meaning to do for a while now. After poking around for a while (I forget which settings I changed, sorry) I opened Activity Monitor and saw that the browser had hoarded a bunch of memory, pushing the memory pressure graph into the yellow range, so I closed it.

I have (repeatedly) run a simple test to reliably reproduce this.

  1. Opened Activity Monitor.
  2. Opened the browser. Do not open tabs or anything. Just let it sit.
  3. Observe the Memory tab in Activity Monitor, specifically the DuckDuckGo row.
  4. Closed the browser completely.

Expected behavior:

I have run the same test on an old HP core-i5 on Windows 10 22h2 and it peaked at 600-something MB of memory before dropping back under 500MB. This is more like what I expected.

Actual behavior:

Between 10 seconds and up to a minute after step 2, the memory allocation began to increase dramatically then plateaued briefly at around 4GB. After a short while, about a GB of memory was released over the span of 20 or more seconds before the browser grabbed more, ballooning to as much as 13.5GB (and likely would have gone higher.)

Eventually, the browser releases some of the memory by itself going back down to around 7GB (which is still too much!) It'll hold on to those 7GB even if you close all tabs. The more times you run the test, the quicker it releases this memory. I guess because it has less competition for that memory soon after releasing it, and can get the cause of this over and done with sooner.

The memory was only fully released after step 4.

@samsymons
Copy link
Collaborator

@meldra Thanks for raising this, and thanks for such a detailed report! 🙏

I ran this test locally and wasn't able to reproduce it out of the box (memory usage is stable at around 150MB for me), so I'm now interested in figuring out what's different between our setups such that this issue would manifest. I'll do some memory leak investigation this week, but for now I have some quick questions:

  1. You mentioned this in step 2, but just to confirm: this was without any webpages at all open, correct?
  2. Did you have the sync feature enabled?
  3. Did you have the VPN enabled?
  4. Do you have any bookmarks or favorites?

@meldra
Copy link
Author

meldra commented Sep 9, 2024

1. You mentioned this in step 2, but just to confirm: this was without any webpages at all open, correct?

Happens with or without pages or additional tabs open. I do note that the longer I tested this for, the slower the spike took to happen. The report is detailed because every time I reproduced a prior assumption got challenged :)

2. Did you have the sync feature enabled?

No it's not. It's still offering me the "sync with another device" button.

3. Did you have the VPN enabled?

I do not have privacy pro, no. The protections pane has:

  • default browser, off
  • private search, on
  • web tracking protection, on
  • cookie pop-up protection, on
  • email protection, off

In case there is any - albeit unlikely - chance of this being relevant, I am connected to a wireguard vpn. iCloud private relay is off.

4. Do you have any bookmarks or favorites?

Just what I agreed to import from firefox, which is actually literally just the default firefox stuff. I'm that kind of weirdo that doesn't typically bookmark or favorite things.

@meldra
Copy link
Author

meldra commented Sep 9, 2024

After leaving the browser open all night, its memory footprint dropped to 350ish mb and this no longer happens at launch.

@meldra
Copy link
Author

meldra commented Sep 9, 2024

Ok I've purged and reinstalled.

It's not reproducing, but I also didn't get the click-through tutorial thingy. Where's it saving that state?

edit: Freshly reinstalled memory usage sitting at half of what it was before reinstall.

@meldra
Copy link
Author

meldra commented Sep 20, 2024

I did eventually figure out where to remove the cache. However, I have not been able to reproduce this issue at all since. If you didn't find a memory leak, probably best to call it an edge case.

@meldra
Copy link
Author

meldra commented Sep 23, 2024

@samsymons I might have tracked down where to look closer.

I've not been able to reproduce the exact workflow as before. But! I have reinstalled DDG a few times trying to figure out what's going on because curiosity, and I have seen other bonkers memory use. When I uninstall, I use App Cleaner to remove everything so I don't miss stuff.

This last time I uninstalled it, I noticed that the containers directory I need to remove manually was over 16GB. The Database.sqlite inside the directory was 16.1GB.

I've also noticed that importing stuff from firefox has been veeeeerrry laggy, similar to #3234, and it also stops responding and as I said earlier I don't have bookmarks other than the defaults.

So, I've just reinstalled again focusing on the import process.

  1. installed DDG
  2. opened activity monitor, observed 110MB usage for DDG
  3. open container directory, observe KBs of .sqlite
  4. started the import wizard
  5. selected firefox (does not happen for Chrome, Safari, Opera, TOR browser,...)
  6. progress bar bounced back and forth then stopped and like 2mm of it stayed filled, it stalled with spinning mouse cursor. DDG is now "not responsive" in activity monitor with 1GB of memory usage.
  7. wait until import finishes and am offered to import passwords (I use keepassxc integration, that might be a factor?). I don't import passwords and close that dialog.
  8. memory usage rockets up ~6GB, drops to ~5GB, crawls up to 7GB.
  9. .sqlite size jumps up to ~45MB, crawls up to 11GB in the time I wrote this all out.

Reloading the browser doesn't fix it. The burn button doesn't fix it. Restarting it after the burn button doesn't fix it.

Deleting Database.sqlite and reloading the browser does fix it.

Are you in the mood for a 11+ GB .sqlite file by any chance?

@github-actions github-actions bot added the stale label Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants