fonts: Measure more FontContext heap usage. (#38733)

Replace a hand-written MallocSizeOf implementation with an automatically
derived one. This exposes more than 1MB of previously-untracked heap
data on servo.org.

Testing: Compared about:memory output for servo.org before and after.
Part of: #11559

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews 2025-08-17 14:59:30 -04:00 committed by GitHub
parent d490c5c06b
commit 9da8142e2a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 59 additions and 32 deletions

View file

@ -23,6 +23,7 @@ ipc-channel = { workspace = true }
keyboard-types = { workspace = true }
markup5ever = { workspace = true }
mime = { workspace = true }
parking_lot = { workspace = true }
resvg = { workspace = true }
servo_allocator = { path = "../allocator" }
servo_arc = { workspace = true }

View file

@ -613,6 +613,18 @@ impl<T: MallocSizeOf> MallocSizeOf for std::sync::Mutex<T> {
}
}
impl<T: MallocSizeOf> MallocSizeOf for parking_lot::Mutex<T> {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
(*self.lock()).size_of(ops)
}
}
impl<T: MallocSizeOf> MallocSizeOf for parking_lot::RwLock<T> {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
(*self.read()).size_of(ops)
}
}
impl<T: MallocSizeOf, Unit> MallocSizeOf for euclid::Length<T, Unit> {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
self.0.size_of(ops)