Open
Bug 1455106
Opened 6 years ago
Updated 2 years ago
Fix memory reporting for IPC shared memory
Categories
(Core :: IPC, enhancement, P2)
Tracking
()
NEW
People
(Reporter: jld, Unassigned)
References
Details
(Whiteboard: [MemShrink:P2])
IPC shared memory seems to have some hooks for tracking the total amount of shared memory allocated and mapped, but it also seems to be broken: on my browser the “mapped” value looks vaguely reasonable but the “allocated” value is 0, and the last time I checked on this the level of brokenness varied by platform. It would probably help to clean up all the shared memory classes (bug 1454819), because the last time I dug into the code it looked like the hooks were weirdly split between levels of no-longer-user abstraction, and that might be why things are broken. (Keep in mind that SharedMemoryBasic has clients other than ipc::Shmem.) We may also want to track the number of shared memory items that {exist, are mapped, have fds open if Unix} separately from total size; see also bug 1453735. On that topic, The_8472 pointed out on IRC that Linux has a limit of 64k memory areas; we don't seem to be at risk of running into that in non-leaky operation, but it's a finite resource that might be leaked.
![]() |
||
Updated•6 years ago
|
Priority: -- → P2
Updated•6 years ago
|
Whiteboard: [MemShrink] → [MemShrink:P2]
Reporter | ||
Comment 1•4 years ago
|
||
This came up recently on Matrix #ipc:mozilla.org
and we've found a few things:
SharedMemoryBasic_mach
has a typo where it callsMapped
instead ofCreated
, so the “allocated” size is always zero and the “mapped” size is increased twice but decreased once (i.e., everything appears as a leak and the mapped size can increase to absurd values)Unmapped
is called only on destruction, not unmap, so a map-unmap-map cycle should also cause false-alarm leaks… but an assertion I added for that didn't fire in a full Try run, so that case may not happen currently (at least with themozilla::
classes; maybe it does for direct use ofbase::SharedMemory
)- The “allocated” metric is weird, because it accounts memory to the process that created it, so a process that only receives shared memory will have 0 allocated but (in the general case) non-zero mapped. More interestingly, if a segment is destroyed by the process that created it while other processes still hold references, it wouldn't be “allocated” anywhere but it would still occupy resources.
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•