mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Refactor common infrastructure for creating memory reports. (#36579)
This removes a bunch of duplicated code needed to support ConditionalMallocSizeOf correctly, and fixes multiple places where that code was subtly wrong (the seen pointers hashset was never cleared). Testing: Measuring https://www.nist.gov/image-gallery lots of times. Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
2a81987590
commit
5e2d42e944
11 changed files with 68 additions and 57 deletions
|
@ -399,11 +399,7 @@ impl Layout for LayoutThread {
|
|||
|
||||
fn exit_now(&mut self) {}
|
||||
|
||||
fn collect_reports(&self, reports: &mut Vec<Report>) {
|
||||
// Servo uses vanilla jemalloc, which doesn't have a
|
||||
// malloc_enclosing_size_of function.
|
||||
let mut ops = MallocSizeOfOps::new(servo_allocator::usable_size, None, None);
|
||||
|
||||
fn collect_reports(&self, reports: &mut Vec<Report>, ops: &mut MallocSizeOfOps) {
|
||||
// TODO: Measure more than just display list, stylist, and font context.
|
||||
let formatted_url = &format!("url({})", self.url);
|
||||
reports.push(Report {
|
||||
|
@ -415,13 +411,13 @@ impl Layout for LayoutThread {
|
|||
reports.push(Report {
|
||||
path: path![formatted_url, "layout-thread", "stylist"],
|
||||
kind: ReportKind::ExplicitJemallocHeapSize,
|
||||
size: self.stylist.size_of(&mut ops),
|
||||
size: self.stylist.size_of(ops),
|
||||
});
|
||||
|
||||
reports.push(Report {
|
||||
path: path![formatted_url, "layout-thread", "font-context"],
|
||||
kind: ReportKind::ExplicitJemallocHeapSize,
|
||||
size: self.font_context.size_of(&mut ops),
|
||||
size: self.font_context.size_of(ops),
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue