allocator: Add optional heap allocation measurement tracking. (#38727)

Add an off-by-default allocator mode that tracks all live allocations
with sizes and associated stack traces. We also track if each allocation
is visited as part of a measuring heap usage in `about:memory`, allowing
us to report on allocations that are not tracked yet. Right now the list
of untracked allocations is dumped to stdout; I have a python script
coming in a separate PR which makes it easier to perform analysis on the
massive output.

Testing: Manually tested with `./mach build -d --features
servo_allocator/allocation-tracking` and visiting about:memory.
Part of: #11559

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews 2025-08-19 14:49:27 -04:00 committed by GitHub
parent 2022831e4f
commit f1a9ceed4f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 280 additions and 7 deletions

3
Cargo.lock generated
View file

@ -6551,6 +6551,7 @@ dependencies = [
"regex",
"serde",
"serde_json",
"servo_allocator",
"servo_config",
"task_info",
"tikv-jemalloc-sys",
@ -7655,6 +7656,8 @@ dependencies = [
name = "servo_allocator"
version = "0.0.1"
dependencies = [
"backtrace",
"fnv",
"libc",
"tikv-jemalloc-sys",
"tikv-jemallocator",