Closed Bug 1539518 Opened 6 years ago Closed 3 years ago

Provide helpers to only show the still-allocated JS object allocations

Categories

(DevTools :: Framework, enhancement, P3)

enhancement

Tracking

(firefox94 fixed)

RESOLVED FIXED
94 Branch
Tracking Status
firefox94 --- fixed

People

(Reporter: ochameau, Assigned: ochameau)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

(Whiteboard: dt-perf-stability-mvp)

Attachments

(1 file)

For now, we do have DEBUG_DEVTOOLS_ALLOCATION environment variable to help debug all the Javascript object allocations that happened during a mochitest or a DAMP test.
While it help understanding what particular code is creating many JS objects,
it doesn't help tracking memory leaks as it doesn't tell you which allocations are still alive or freed. It only tells you about where objects were allocated.

We could probably use memory.takeCensus in order to provide a view on the still-allocated objects, which would ignore all the allocations that have been freed.

Then, once we have this view, we can probably collect a metric, similar to modules metrics introduced in bug 1458194.
The view would help trying to figure out some leaks while the record would help prevent regressions.

Assignee: nobody → poirot.alex
Severity: normal → enhancement
Priority: -- → P3
Blocks: 1540693
Depends on: 1540694
Depends on: 1540761
Depends on: 1541819
Depends on: 1597999
Depends on: 1727571
Whiteboard: dt-perf-stability-triage
Blocks: 1727837

This new method allows to do some kind of diff between two allocation sites records.
It will ignore/substract the allocation sites from the first record when processing the second.

As this can sometime return only allocations without stacks,
the old view, showing all the allocations is still helpful.

Also both views can't work at the same time.
So, DEVTOOLS_DEBUG_ALLOCATIONS env variable is used to enable one of the two views.
DEVTOOLS_DEBUG_ALLOCATIONS=allocations will display all the allocation log (which may display allocations which have been freed)
DEVTOOLS_DEBUG_ALLOCATIONS=leaks will display only the allocation which are still allocated at the end of the test. So it should only display leaks.

Whiteboard: dt-perf-stability-triage → dt-perf-stability-mvp
Pushed by apoirot@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d7782723aa2a [devtools] Log allocations sites of object being created during the test and not being freed. r=jdescottes
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 94 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: