Closed Bug 932152 Opened 11 years ago Closed 4 years ago

API to measure the size of a JS object

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: Felipe, Unassigned)

Details

(Whiteboard: [MemShrink:P2])

It'd be nice to have an API to measure the memory used by a particular JS object. Specially if it can be called from JS. I don't know how that would behave when the object contains cyclic references or what would it report when it has references to other shared objects. But my main use case is that such an API would be useful to measure vanilla JS objects that are storing "only data" (plus perhaps some functions in the prototype) which are being used for some in-memory data storage (usually reflected to JSON storage on disk).
The current infrastructure is set up to measure one GC-thing (object, string, etc) at a time. This is because the JS memory reporters iterate over the JS heap one GC-thing at a time. So it's easy to measure one object in isolation (including malloc'd memory hanging off it, e.g. for a big array of integers). Measuring GC things that hang off an object as well (other objects, strings) is harder, as you suggest.
Whiteboard: [MemShrink]
Whiteboard: [MemShrink] → [MemShrink:P2]
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.