beaker icon indicating copy to clipboard operation
beaker copied to clipboard

Beaker eats lots of RAM

Open fsteff opened this issue 4 years ago • 8 comments

Describe the bug I observed that, after surfing around on the hyper:// web, the process needs more and more RAM. Even after closing the window, when it only runs in the background, it needs up to 1GB. Looks like you either have a memory leak or the node gc is not aggressive enough. On my machine this is not really an issue, but if someone has a cheap laptop it might cause real problems. On one occasion the UI also got really slow, but I was not able to reproduce that.

To Reproduce Nothing specific, just happens after surfing larger pages.

Expected behavior At least after closing the browser window most of the memory is freed.

Desktop (please complete the following information):

  • OS: Windows 10
  • Version: Beaker v1.0.0-prerelease.1

fsteff avatar May 15 '20 14:05 fsteff

We'll need to run some memory-usage audits. Thanks for filing.

pfrazee avatar May 15 '20 14:05 pfrazee

@fsteff thanks for filing. I have a low memory laptop (4GB) and faced this exact issue. Launching Beaker seems to slow my system significantly.

aadilayub avatar May 15 '20 15:05 aadilayub

On windows 10 it seems to start 26 processes, starting from 7.5MByte up to 115MByte memory usage each. So it's about 770MByte in sum

I do have 3 tabs pinned + New Tab

FF uses 10 threads with about 1.1GByte in use. 7 tabs pinned + 1 active ... and about 100 hidden tabs in a tab manager.

MS Edge uses 10 processes 300MByte with 4 tabs open. ...

Chrome uses 13 processes ~300MByte after some time with 4 tabs open.

So these browser tests are not really comparable ... but memory wise Beaker isn't seems to be ok-ish. but seems to be a bit heavy on sub-processes.

After closing the beaker app, the processes seem to be not closed. .. None of them. ... More tests needed.

pmario avatar May 15 '20 15:05 pmario

  • Quit beaker with "Quit Beaker" all of them are gone.

  • Starting beaker 15 processes are back.

  • Closing Beaker .. 9 processes are still running

  • Starting Beaker ... 20 processes are used now.

pmario avatar May 15 '20 16:05 pmario

2.36GB With 1 tab open beaker-high-memory-usage

Appimage 1.0.0-prerelease.7 OS: MX 19.2 (patito feo) x86_64 SysV init version: 2.93 Debian GNU/Linux 10 (buster) Kernel: 4.19.0-9-amd64 WM: awesome

danrobi11 avatar Aug 25 '20 13:08 danrobi11

blog-post-background-bug.gif

Hard to see in the .gif video. Was to show that I only have 1 tab open. Beaker running for 2 days = 4.43gb

4g ram usage beaker

danrobi11 avatar Aug 26 '20 12:08 danrobi11

Definitely something going on with the hyperdrive daemon there. Let's see if the new hyperspace daemon fixes this. (Mem leaks are an ongoing fight ofc)

pfrazee avatar Aug 26 '20 16:08 pfrazee

Just a note: As V8 – and thus Node.js, Chrome, Electron – has a generational garbage collection, data that survives to the older generation will get accumulated until the process reaches a set limit and only then garbage collected.

So it doesn't have to be a memory leak to "leak" memory, it can also be a "garbage" leak where excessive amounts of data reach the older generation and thus gets accumulated there over time.

Garbage leaks can be handled in two ways: Either eliminate the leaks or lower the target at which is it should be GC:ed.

Have you checked for garbage leaks @pfrazee?

voxpelli avatar Aug 26 '20 22:08 voxpelli