mirror of
https://github.com/servo/servo.git
synced 2025-09-29 16:19:14 +01:00
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:
parent
2022831e4f
commit
f1a9ceed4f
8 changed files with 280 additions and 7 deletions
|
@ -293,7 +293,7 @@ pub fn perform_memory_report<F: FnOnce(&mut MallocSizeOfOps)>(f: F) {
|
|||
let seen_pointer = move |ptr| SEEN_POINTERS.with(|pointers| !pointers.borrow_mut().insert(ptr));
|
||||
let mut ops = MallocSizeOfOps::new(
|
||||
servo_allocator::usable_size,
|
||||
None,
|
||||
servo_allocator::enclosing_size,
|
||||
Some(Box::new(seen_pointer)),
|
||||
);
|
||||
f(&mut ops);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue