Skip to content

Memory profiling

Philip Chimento requested to merge ptomato/gjs:memory-counter into master

This adds a few things:

  • More detailed garbage collection timings are output to Sysprof.
  • The values of the memory counters are output to Sysprof on every profiler sampling tick.
  • A new API System.dumpMemoryInfo() which writes some memory information from the JS engine to a file (or stdout if none is given), and outputs an approximate count of occupied GC and malloc bytes to Sysprof.

The occupied malloc bytes statistic is lower than the actual value because we don't use JS::AddAssociatedMemory() everywhere that heap memory is tied to GC memory. (See #52.)

There is more detailed accounting that we could access, similar to what Firefox's about:memory page does, but it seems to be a bit unreliable for our purposes because it's built to accommodate Firefox's COM implementation, and it's not possible with the current API to report our heap usage correctly. See ptomato/gjs@c1746c3a for a work-in-progress and some more explanation if you are interested.

Here's a screenshot of what it looks like in Sysprof: Screenshot_from_2021-05-28_23-47-51

Closes: #292 (closed)

Merge request reports