allocation-tracker.js |
This file helps tracking Javascript object allocations.
It is only included in local builds as a debugging helper.
It is typicaly used when running DevTools tests (either mochitests or DAMP).
To use it, you need to set the following environment variable:
DEBUG_DEVTOOLS_ALLOCATIONS="normal"
This will only print the number of JS objects created during your test.
DEBUG_DEVTOOLS_ALLOCATIONS="verbose"
This will print the allocation sites of all the JS objects created during your
test. i.e. from which files and lines the objects have been created.
In both cases, look for "DEVTOOLS ALLOCATION" in your terminal to see tracker's
output.
But you can also import it from your test script if you want to focus on one
particular piece of code:
const { allocationTracker } =
require("devtools/shared/test-helpers/allocation-tracker");
// Calling `allocationTracker` will immediately start recording allocations
let tracker = allocationTracker();
// Do something
// If you want to log all the allocation sites, call this method:
tracker.logAllocationLog();
// Or, if you want to only print the number of objects being allocated, call this:
tracker.logCount();
// Once you are done, stop the tracker as it slow down execution a lot.
tracker.stop();
|
22295 |
browser.toml |
|
465 |
browser_allocation_tracker.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
7544 |
moz.build |
|
452 |
test-line-tracer.js |
|
5846 |
test-stepper.js |
|
2871 |
tracked-objects.sys.mjs |
Request to track why the given object is kept in memory,
later on, when retrieving all the watched object via getAllNodeIds.
|
1549 |