script: Measure stored layout data memory usage. (#36664)

We previously ignored the opaque layout data field inside each node when
measuring a DOM node's memory usage. While some of the reachable memory
was accounted for by measuring the layout's box tree, measuring it via
the node ensures that we don't miss anything. Since there are often Arc
values involved, this means that the layout-thread box tree measurements
now look quite small, while reported JS heap usage has increased.

Testing: Manually compared about:memory for servo.org.

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews 2025-04-24 08:01:51 -04:00 committed by GitHub
parent 9dc56d420f
commit 878d595035
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 34 additions and 14 deletions

View file

@ -2439,8 +2439,6 @@ impl ScriptThread {
let mut reports = vec![];
perform_memory_report(|ops| {
let prefix = format!("url({urls})");
reports.extend(self.get_cx().get_reports(prefix.clone(), ops));
for (_, document) in documents.iter() {
document
.window()
@ -2448,6 +2446,9 @@ impl ScriptThread {
.collect_reports(&mut reports, ops);
}
let prefix = format!("url({urls})");
reports.extend(self.get_cx().get_reports(prefix.clone(), ops));
reports.push(self.image_cache.memory_report(&prefix, ops));
});