SharedArrayBuffer memory is not accounted for
Categories
(Core :: JavaScript: GC, defect, P1)
Tracking
()
People
(Reporter: jonco, Assigned: jonco)
References
Details
(Whiteboard: [MemShrink:P2])
Attachments
(2 files, 2 obsolete files)
The mapped memory used for shared array buffers is not currently reported to the GC memory accounting framework.
Comment 1•6 years ago
|
||
The priority flag is not set for this bug.
:jonco, could you have a look please?
For more information, please visit auto_nag documentation.
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Comment 2•6 years ago
|
||
Luke, at the moment I think these are only ever mapped into a single process (but may be shared between multiple runtimes). Is that correct? Are there any plans to change that?
![]() |
||
Comment 3•6 years ago
|
||
Correct, and there is even an intention not to allow this.
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Comment 4•6 years ago
|
||
This makes the hash table used for tracking ZoneAllocPolicy generic and able to track memory owned by other non-GC things. I'm not entirely sold on the 'other' naming but didn't really like any other alternative I could come up with. The idea is to use this for tracking the memory associated with shared array buffers in the next patch.
Assignee | ||
Comment 5•6 years ago
|
||
The challenge here is that the buffers can be shared between zones in different runtimes and also used by more than one SharedArrayBuffer JS object in a zone. The buffers can be large so we want to avoid double-counting. The patch stores a count of the number of SAB objects using a buffer in each zone in a hash table on the SharedArrayRawBuffer. Access is protected by the buffer's mutex to allow this to work when used by different runtimes. This is a bit more heavyweight that I'd have liked, but I figure creating and SAB objects is not going to be a super-hot code path.
Depends on D55533
Updated•6 years ago
|
Assignee | ||
Comment 6•6 years ago
|
||
I'll land the first patch now so it doesn't rot.
Comment 8•6 years ago
|
||
bugherder |
Assignee | ||
Comment 9•6 years ago
|
||
This adds zone methods to account for 'shared' memory, in the sense of shared between more than one GC thing in the zone. The hash map used to track allocations moves to the zone, and we don't have to take a lock. We do need to make the SAB finalizer run on the main thread however (but I think this was going to happen anyway with Lars' patch).
One complication is that the same allocation can be added to the zone with different sizes, when a SAB grows. So we track the size too and update the memory accounting when it increases.
Comment 10•6 years ago
|
||
Assignee | ||
Comment 11•6 years ago
|
||
Comment 12•6 years ago
|
||
Updated•6 years ago
|
Updated•6 years ago
|
Comment 13•6 years ago
|
||
bugherder |
Assignee | ||
Updated•6 years ago
|
Description
•