Closed
Bug 1404793
Opened 8 years ago
Closed 8 years ago
Firefox requires at least 27GB of virtual memory to compile asm.js script(s)
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: fuine, Unassigned)
Details
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0
Build ID: 20170918122929
Steps to reproduce:
Also reproducible on release v55 and v57 beta
Prior to running firefox set a virtual memory limit (for my case it is up to 26GB of virtual memory on 16GB hardware RAM machine), on linux `ulimit -v $((1024*1024*x))` where x is the amount in gigabytes.
Open firefox in the same virtual-memory-restricted shell session (or set the global restriction). Then go to the https://mail.protonmail.com/login page.
Actual results:
Site is stuck on a loading animation, console logs some errors, including `uncaught exception: out of memory`.
Expected results:
Login site should appear.
There are 2 issues that I originally filed in the webcompat repository regarding this issue (https://github.com/webcompat/web-bugs/issues/9963, https://github.com/webcompat/web-bugs/issues/10031). #9963 contains a proof of reproducibility.
This might not be a bug, but I find it hard to believe that compiling some javascript code would require so much virtual memory.
Comment 2•8 years ago
|
||
The JS engine reserves a lot of memory for asmjs, but doesn't actually use it. It sounds like this could be what you're observing. Jan, does the amount of memory described fit with what spidermonkey does?
Component: Memory Allocator → JavaScript Engine
Flags: needinfo?(jdemooij)
Comment 3•8 years ago
|
||
Luke is more familiar with the asm.js code.
Flags: needinfo?(jdemooij) → needinfo?(luke)
Comment 4•8 years ago
|
||
Yeah, this is just virtual address space reservation for the asm.js heap, not actual committed memory, so this isn't using up your RAM, just some few records in the kernel claiming the space. Each asm.js memory reserves 6gb and I can confirm via an instrumented build that protonmail is using 7 memories.
Flags: needinfo?(luke)
Comment 5•8 years ago
|
||
The report is correct but this behavior is by design (and matches what other engines do (maybe not for asm.js, but for wasm for sure)) so tentatively marking as WONTFIX.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
Thanks for the prompt reply. I understand the difference between virtual memory and actual memory used by the process, so is there a place for me to read up on the design decisions behind this vram hogging mechanism (I can't really call it any other way) in the asm.js/wasm heap?
Comment 7•8 years ago
|
||
Not really; it's a significant optimization that allows all bounds checks to be removed by guaranteeing out-of-bounds accesses reliably generated safely-handled signals.
You need to log in
before you can comment on or make changes to this bug.
Description
•