Web code should be able to label allocations, for later grouping in devtools

NEW
Unassigned

Status

()

Firefox
Developer Tools: Memory
P3
normal
2 years ago
2 years ago

People

(Reporter: jimb, Unassigned)

Tracking

(Blocks: 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

2 years ago
It should be possible for content JavaScript to somehow mark certain allocations, or periods of allocation, as interesting for later analysis.

Often someone debugging a leak has some idea where the problem is, and would like to be able to isolate the behavior of one part of the application from the rest, and view the behavior of only that part.

One can accomplish this by temporarily deleting all the other parts of the application, but this will probably be pretty disruptive.

I don't know what API would be useful, but I imagine something like this might work:

    devtools.mark('foo', () => { ... do stuff ...})

This would call the closure, and then forward its return value or exception to the caller, transparently. However, all allocation carried out by the closure would have the mark 'foo' attached to it.

The memory tools would allow the developer to select only those allocations marked 'foo' for the report.
The console object is the typical place to add these methods which trigger unobservable-to-content-JS effects that are visible in devtools, eg console.profile().
(Reporter)

Comment 2

2 years ago
(In reply to Nick Fitzgerald [:fitzgen] [⏰PST; UTC-8] from comment #1)
> The console object is the typical place to add these methods which trigger
> unobservable-to-content-JS effects that are visible in devtools, eg
> console.profile().

Okay, that makes sense.
Has STR: --- → irrelevant
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.