Closed Bug 1705318 Opened 3 years ago Closed 3 years ago

Make it possible to distinguish profiler-specific memory usage from the rest of Firefox

Categories

(Core :: Gecko Profiler, task, P2)

task

Tracking

()

RESOLVED FIXED
90 Branch
Tracking Status
firefox90 --- fixed

People

(Reporter: mozbugz, Assigned: florian)

References

Details

Attachments

(1 file)

Because of the recent changes to the profiler buffers, we now allocate "chunks" to grow the buffer as needed.

These allocations are counted as part of the "malloc" counter.
On the front-end, it makes the memory graph look like it's (almost) always growing. Though it is technically correct, this could be misleading in making the user think that there may be a leak in Firefox code, when this memory increase wouldn't happen when the profiler is not running, which is what the user is presumably most interested in.
And since chunks are typically 1MB, they could hide smaller changes that the user would also be interested in.

Possible solutions:

  • Profiler allocations could be re-counted as negative in the existing counter, to cancel them. (Nothing to do on the front-end.)
  • When recording the memory counter in the sampler loop, subtract the current profiler buffer size. (Nothing to do on the front-end.)
  • Explicitly record profiler memory allocations, either in markers, or in another counter. The front-end would then have to do the subtraction when showing the memory graph.
    As a bonus, the front-end could display both graphs together (with and without profiler memory) if that's useful, and this could prepare for future improvements where the memory could be further split into different "arenas" (if technically possible).

cc:Nazim for thoughts on how to interact with the front-end.

Assignee: nobody → florian
Status: NEW → ASSIGNED

(In reply to Gerald Squelart [:gerald] (he/him) from comment #0)

  • When recording the memory counter in the sampler loop, subtract the current profiler buffer size. (Nothing to do on the front-end.)

The patch I submitted uses this approach. Here's an example profile: https://share.firefox.dev/2PTm2Zp

Pushed by fqueze@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/dc233d67c656
substract the memory used by the profiler buffer when sampling the memory counter, r=gerald.
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 90 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: