Closed Bug 1068696 Opened 5 years ago Closed 5 years ago

Ensure memory for SharedArrayBuffer is properly tracked

Categories

(Core :: JavaScript Engine, defect)

defect
Not set

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: lth, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [MemShrink])

More an investigative item than a bug: I'm not sure if the memory for the SharedArrayBuffer is tracked by memory measurements, but it ought to be (somehow).
Whiteboard: [MemShrink]
SharedArrayBufferObject::addSizeOfExcludingThis() exists, and is called appropriately from JSObject::addSizeOfExcludingThis().

It looks like this:

> /* static */ void
> SharedArrayBufferObject::addSizeOfExcludingThis(JSObject *obj, mozilla::MallocSizeOf mallocSizeOf,
>                                                 JS::ClassInfo *info)
> {
>     info->objectsNonHeapElementsMapped += obj->as<SharedArrayBufferObject>().byteLength();
> }   

If SharedArrayBufferObject only has a single buffer and it's always mmapped then I think we're ok. 

You should be able to confirm by running an example that uses a large SharedArrayBufferObject and then looking in about:memory -- just search for "SharedArrayBufferObject" (assuming you're on a Nightly build or similar).
(In reply to Nicholas Nethercote [:njn] from comment #1)
> 
> If SharedArrayBufferObject only has a single buffer and it's always mmapped
> then I think we're ok. 

It does.

> You should be able to confirm by running an example that uses a large
> SharedArrayBufferObject and then looking in about:memory -- just search for
> "SharedArrayBufferObject" (assuming you're on a Nightly build or similar).

I did, and it works.  Thanks.
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.