desktop icon indicating copy to clipboard operation
desktop copied to clipboard

Too much RAM Consumption

Open subhashhhhhh opened this issue 1 year ago • 35 comments

What happened?

I've been using Zen Browser since yesterday and I've noticed that it's consuming unusually high amount of RAM. Almost 3GB ram on my 8GB M1 Air.

image

Reproducible?

  • [X] I have checked that this issue cannot be reproduced on Mozilla Firefox.

Version

1.0.0-a.28

Severity impact

Medium

What platform are you seeing the problem on?

macOS - aarch64

Relevant log output

No response

subhashhhhhh avatar Aug 23 '24 15:08 subhashhhhhh

Facing a similar issue on an 8GB M2 Macbook Air, Zen is using around 800MB of memory on a fresh open with only one DuckDuckGo tab open: image

thrzl avatar Aug 23 '24 21:08 thrzl

@thrzl how much memory does stock Firefox use on your device with one tab open?

n7itro avatar Aug 24 '24 09:08 n7itro

@thrzl how much memory does stock Firefox use on your device with one tab open?

not more than 1GB

CleanShot 2024-08-24 at 15 34 41@2x

subhashhhhhh avatar Aug 24 '24 10:08 subhashhhhhh

@thrzl how much memory does stock Firefox use on your device with one tab open?

Firefox actually also uses 800MB, and as more tabs are added, Firefox actually uses more ram than Zen. I was unaware that Firefox itself used this much memory.

As a workaround I've installed Auto Tab Discard which helps a bit, but this still is preventing me fom using this browser as much as I'd like to.

thrzl avatar Aug 24 '24 18:08 thrzl

image Yeah this is a lot, I usually observe Firefox use max of 2GB with more tabs than I have right now.

vunhatchuong avatar Aug 25 '24 02:08 vunhatchuong

A single Twitch stream tab hogs 2GB.

vunhatchuong avatar Aug 25 '24 02:08 vunhatchuong

Hey @mauro-balades

Can this be a kind of memory leak? my brother (the guy that we play overwatch with) reports this happens to him when he leaves Zen open all night, it reaches 5000mb.

But if he closes it and opens it again it gets back to normal (300mb)

IAmJafeth avatar Aug 25 '24 04:08 IAmJafeth

Also had the same issue and it seems that Zen does not really close tabs nor minimize their consumption of RAM while being inactive or even closed. Also, on a clean open with only github opened, firefox uses 190MB whereas Zen uses more than 350MB and more CPU usage.

It is sad because Zen looked like a great alternative, and as @IAmJafeth proposed, it is probably a memory leak or lack of limit on inactive tabs but I hope it will be fixed soon.

CarrotRub avatar Aug 25 '24 12:08 CarrotRub

Got same issue, I have 8 GB of RAM and have 4 workspaces (including default) and it consumes +4 GB. I think this browser still doesn't have a tab sleeper, just like Brave.

juan-m-campos avatar Aug 25 '24 22:08 juan-m-campos

What does about:processes and about:memory show?

niutech avatar Aug 27 '24 22:08 niutech

For me, after a few hours of browsing and an in-browser Zoom meeting:

about:memory memory report: memory-report.json

about:processes: image

thrzl avatar Aug 28 '24 01:08 thrzl

@thrzl The single most memory consuming process from your report is web extensions:

{
    "process": "WebExtensions (pid 48502)",
    "path": "vsize",
    "kind": 2,
    "units": 0,
    "amount": 440066981888,
    "description": "Memory mapped by the process, including code and data segments, the heap, thread stacks, memory explicitly mapped by the process via mmap and similar operations, and memory shared with other processes. This is the vsize figure as reported by 'top' and 'ps'.  This figure is of limited use on Mac, where processes share huge amounts of memory with one another.  But even on other operating systems, 'resident' is a much better measure of the memory resources used by the process."
}

niutech avatar Aug 28 '24 09:08 niutech

Over time - the memory use seems to grow. It got to the point of having a memory footprint of 40GB, after a few hours. This happened twice so far - and both times had only a handful of tabs with static content, and only 1 extension (bitwarden)

lee-orr avatar Aug 30 '24 17:08 lee-orr

Does it help when you go to about:memory and click Minimize memory usage? Or when you install Auto Tab Discard add-on?

niutech avatar Aug 30 '24 20:08 niutech

@thrzl The single most memory consuming process from your report is web extensions:

{
    "process": "WebExtensions (pid 48502)",
    "path": "vsize",
    "kind": 2,
    "units": 0,
    "amount": 440066981888,
    "description": "Memory mapped by the process, including code and data segments, the heap, thread stacks, memory explicitly mapped by the process via mmap and similar operations, and memory shared with other processes. This is the vsize figure as reported by 'top' and 'ps'.  This figure is of limited use on Mac, where processes share huge amounts of memory with one another.  But even on other operating systems, 'resident' is a much better measure of the memory resources used by the process."
}

This itself is questionable, as the only extensions I have are uBlock Origin, Auto Tab Discard, and an au2001's iCloud Keychain extension.

I also wanted to ask what unit the memory usage is being measured in here?

thrzl avatar Aug 30 '24 21:08 thrzl

At least on my end - it's definitely part of the main process rather than one of the individual tabs:

Main Process (pid 22568)
Explicit Allocations

24,112.50 MB (100.0%) -- explicit
├──23,704.16 MB (98.31%) -- js-non-window
│  ├──23,347.38 MB (96.83%) -- zones
│  │  ├──23,336.88 MB (96.78%) -- zone(0x12306de00)
│  │  │  ├──22,966.69 MB (95.25%) -- strings
│  │  │  │  ├──22,926.52 MB (95.08%) -- string(length=333802, copies=22926, "First Name,Last Name,," (truncated))
│  │  │  │  │  ├──22,926.00 MB (95.08%) ── malloc-heap/two-byte
│  │  │  │  │  └───────0.52 MB (00.00%) ── gc-heap/two-byte
│  │  │  │  └──────40.16 MB (00.17%) ++ (106 tiny)
│  │  │  └─────370.19 MB (01.54%) ++ (26 tiny)
│  │  └──────10.50 MB (00.04%) ++ (2 tiny)
│  ├─────303.96 MB (01.26%) ++ gc-heap
│  └──────52.83 MB (00.22%) ++ (3 tiny)
└─────408.34 MB (01.69%) ++ (34 tiny)

Other Measurements

23,213.30 MB (100.0%) -- decommitted
├──23,196.80 MB (99.93%) -- heap
│  ├──23,038.01 MB (99.24%) ── decommitted
│  └─────158.80 MB (00.68%) ++ unused-pages
└──────16.50 MB (00.07%) ++ (2 tiny)

(this is for my currently running process - which hasn't gotten to the crashing point yet - and the total is much higher than if you add all the tabs).

lee-orr avatar Aug 30 '24 22:08 lee-orr

@lee-orr What is this string(length=333802, copies=22926, "First Name,Last Name,Office/Title..." (truncated))?

niutech avatar Aug 31 '24 10:08 niutech

@lee-orr What is this `string(length=333802, copies=22926, "First Name,Last Name,Office/Title..." (truncated))

One of the tabs I had open had a csv in a text editor - strange that it ended up so large since the csv was just sitting open. I'll investigate this further in case it's an issue with that web page, and see if the memory issue occurs without that page.

lee-orr avatar Aug 31 '24 13:08 lee-orr

Yep, it's a memory leak, and like stated above, one process is responsible for it, but according to my diagnosing (might be limited to the windows build), not the extensions, but rather streaming/video platforms.

Before garbage collection? (Yt tab open)

image

After garbage collection? (Yt tab open)

image

it seems to be reaching up to 5gb of ram and then garbage collecting/clearing cached media, might be issues with streaming services.

Closed the YouTube tab then let it reach 5gb and garbage collect

image after this last memory collection the memory stays stable @ 1gb on 3 tabs.

Probable source:

Screenshot 2024-09-09 104652

AtTheZenith avatar Sep 09 '24 07:09 AtTheZenith

@AtTheZenith What does about:memory report? What if you open Zen in safe mode? (press and hold the Shift key and launch Zen)

niutech avatar Sep 09 '24 12:09 niutech

@AtTheZenith What does about:memory report? What if you open Zen in safe mode? (press and hold the Shift key and launch Zen)

1.2gb ram usage (in safe mode) under normal workload, and surprisingly, i can't reproduce it anymore, 1.6gb ram in a normal window under normal workload, i can live with this.

note: by garbage collection i assumed the browser had a garbage collector doing its thing.

AtTheZenith avatar Sep 09 '24 13:09 AtTheZenith

In my case, high memory consumption comes mainly from pinned tabs and Sidebar panels, which it would seem are never unloaded e.g. Meta's Messenger consumes about 300MB of RAM.

As @thrzl mentioned, Auto Tab Discard definitely helps here. For now, the best workaround I found was adding such memory intensive websites to Immediately discard the following hostnames when their tab is not active domain list.

I also noticed this extension does not work with Zen Sidebar panels, which are also kept in memory

MariuszGaljanVT avatar Sep 09 '24 14:09 MariuszGaljanVT

i forgot to mention task killing the memory intensive program (that was consuming 3 out of 5 gb) kills my youtube tab

and @MariuszGaljanVT your hypothesis of it being pinned tab is valid, youtube for me hogs this much only when i have it pinned

AtTheZenith avatar Sep 10 '24 06:09 AtTheZenith

agreed, i have 16gb, when i let zen open and load thee moodle tabs is goes to 8gb of ram, it just crashed my whole system, needed to hard poweroff if, using the flatpak on ubuntu 24.04.01

Humam-Hamdan avatar Sep 11 '24 20:09 Humam-Hamdan

At work, I have a machine with 32GB that was topped up while using Zen for some hours. Checking the System Monitor, there was one "Isolated Web Co" consuming over 20GB! I just installed it yesterday and was browsing the same webpages I used in Chrome, and with the same extensions I have installed and in sync with Firefox.

nneto avatar Sep 17 '24 17:09 nneto

From what I've heard in their Discord server, this is normal behavior, and memory usage will decrease if you have more processes open: image image

As for macOS though, it seems like a Firefox thing, I've experienced the same on that browser too so it's most likely not a Zen issue (MacBook Air M1)

greeeen-dev avatar Sep 19 '24 17:09 greeeen-dev

From what I've heard in their Discord server, this is normal behavior, and memory usage will decrease if you have more processes open: image image

As for macOS though, it seems like a Firefox thing, I've experienced the same on that browser too so it's most likely not a Zen issue (MacBook Air M1)

In my case, it consumed so much RAM that vscode crashed for lack of memory

nneto avatar Sep 19 '24 18:09 nneto

image

This is the memory usage on my Macbook (36 GB Ram)

  • Zen has only 1 tab (Youtube video)
  • Chrome has 13 tabs (1 Youtube video)

I often see meme about Chrome eating too much Ram, but now I see that Zen browser is eating even more

piavgh avatar Oct 01 '24 02:10 piavgh

@piavgh What does about:processes show?

niutech avatar Oct 01 '24 08:10 niutech

@piavgh What does about:processes show?

@niutech : how to navigate to that menu? I don't see about:processes anywhere

piavgh avatar Oct 01 '24 08:10 piavgh