Open
Bug 700343
Opened 15 years ago
Updated 4 years ago
On Mac, decommitted pages in a GC chunk are counted against RSS
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
NEW
People
(Reporter: justin.lebar+bug, Unassigned)
References
Details
We MADV_FREE GC pages when we "decommit" them on Mac. But MADV_FREE'd pages are still counted against our process's RSS. We need to explicitly purge them in order to correctly compute our memory usage.
Bug 670596, comment 52:
The problem is that on Mac, when you madvise(MADV_FREE), you're hinting to the OS, "I don't need these pages, so you can take them back whenever." The OS is lazy about this, and only takes back the pages when there's memory pressure on the machine. Until then, they count against your RSS.
This means that whatever memory gains you're getting from MADV_FREE, you can't measure with RSS. You could say that your "true RSS" is RSS minus the number of pages you've MADV_FREE'd, but then when you have memory pressure and the OS frees those pages, you're under-counting your RSS!
The hack we did in jemalloc is to add a function which explicitly purges all MADV_FREE'd pages, by decommitting and recommitting them (with mmap(PROT_NONE) and mmap(PROT_READ | PROT_WRITE)). We then call this function before we read RSS on Mac [1].
This way, when you open about:memory, you'll see the correct RSS (in about:memory and in the Mac task manager). Telemetry also calls this function, so it'll report the correct result.
| Assignee | ||
Updated•12 years ago
|
Assignee: general → nobody
Updated•4 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•