Repository navigation
More granular script thread memory reporting - #46931
Merged
Merged
Conversation
pylbrecht
force-pushed
the
pylbrecht/push-usq
branch
from
August 2, 2026 07:46
e5e7cc1 to
b91e14a
Compare
jdm
reviewed
Aug 2, 2026
pylbrecht
force-pushed
the
pylbrecht/push-usq
branch
3 times, most recently
from
August 5, 2026 20:10
f5cde69 to
0f1881d
Compare
pylbrecht
force-pushed
the
pylbrecht/push-usq
branch
5 times, most recently
from
August 20, 2026 16:59
5458f17 to
4385d39
Compare
jdm
requested changes
Aug 21, 2026
jdm
left a comment
Member
There was a problem hiding this comment.
This is a good start! We just need to shuffle around a few pieces to make sure that we don't overcount.
pylbrecht
force-pushed
the
pylbrecht/push-usq
branch
5 times, most recently
from
August 23, 2026 05:29
cd06bef to
7cdbea6
Compare
pylbrecht
force-pushed
the
pylbrecht/push-usq
branch
3 times, most recently
from
August 25, 2026 10:24
100a3dc to
288c93d
Compare
pylbrecht
marked this pull request as ready for review
August 25, 2026 10:24
Contributor
Author
|
@jdm, I cleaned up the commit mess and added a PR description. Let me know if you have any more feedback. Happy to address it! |
So far, all Rust memory for DOM objects ended up in a single category
(MallocHeap).
To get a more fine-grained view into memory usage, we are now counting
DOM object sizes:
```rust
struct DocumentSizes {
element_nodes_size: usize,
text_nodes_size: usize,
attribute_nodes_size: usize,
other_nodes_size: usize,
}
```
For flexibility reasons, we do the counting within Servo instead of
within SpiderMonkey.
When collecting memory reports from the script thread, we traverse each
document and accumulate node sizes into `DocumentSizes`. We remember,
which nodes we already visited (`ALREADY_COMPUTED_OBJECTS`), and ignore
these in `get_size()` to avoid counting them twice.
---
Signed-off-by: pylbrecht <pylbrecht@mailbox.org>
pylbrecht
force-pushed
the
pylbrecht/push-usq
branch
from
August 25, 2026 12:40
288c93d to
402841c
Compare
Contributor
Author
|
Thanks, @jdm! I couldn't have done it without your support. 🙏 |
pull Bot
pushed a commit
to Haofei/servo
that referenced
this pull request
Aug 28, 2026
…ervo#47531) Building on top of servo#46931, this adds a new `out-of-tree` entry to the DOM memory report which automatically groups all memory for each previously-unmeasured WebIDL interface that is encountered when measuring the objects in the GC graph. Any object measured when traversing the tree is excluded from this, so we won't count any objects twice even if we add new grouping categories. Testing: No automated tests for about:memory at this time. --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
RichardTjokroutomo
pushed a commit
to RichardTjokroutomo/servo
that referenced
this pull request
Oct 6, 2026
So far, all Rust memory for DOM objects ended up in a single category
(MallocHeap).
To get a more fine-grained view into memory usage, we are now counting
DOM object sizes:
```rust
struct DocumentSizes {
element_nodes_size: usize,
text_nodes_size: usize,
attribute_nodes_size: usize,
other_nodes_size: usize,
}
```
For flexibility reasons, we do the counting within Servo instead of
within SpiderMonkey.
When collecting memory reports from the script thread, we traverse each
document and accumulate node sizes into `DocumentSizes`. We remember,
which nodes we already visited (`ALREADY_COMPUTED_OBJECTS`), and ignore
these in `get_size()` to avoid counting them twice.
<img width="1354" height="1568" alt="image"
src="https://github.com/user-attachments/assets/fc217398-fd99-4665-b9bf-9ea0f6ed140b"
/>
---
Testing: manual
Fixes: servo#44995
Signed-off-by: pylbrecht <pylbrecht@mailbox.org>
RichardTjokroutomo
pushed a commit
to RichardTjokroutomo/servo
that referenced
this pull request
Oct 6, 2026
…ervo#47531) Building on top of servo#46931, this adds a new `out-of-tree` entry to the DOM memory report which automatically groups all memory for each previously-unmeasured WebIDL interface that is encountered when measuring the objects in the GC graph. Any object measured when traversing the tree is excluded from this, so we won't count any objects twice even if we add new grouping categories. Testing: No automated tests for about:memory at this time. --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Psychpsyo
pushed a commit
to Psychpsyo/servo
that referenced
this pull request
Oct 12, 2026
So far, all Rust memory for DOM objects ended up in a single category
(MallocHeap).
To get a more fine-grained view into memory usage, we are now counting
DOM object sizes:
```rust
struct DocumentSizes {
element_nodes_size: usize,
text_nodes_size: usize,
attribute_nodes_size: usize,
other_nodes_size: usize,
}
```
For flexibility reasons, we do the counting within Servo instead of
within SpiderMonkey.
When collecting memory reports from the script thread, we traverse each
document and accumulate node sizes into `DocumentSizes`. We remember,
which nodes we already visited (`ALREADY_COMPUTED_OBJECTS`), and ignore
these in `get_size()` to avoid counting them twice.
<img width="1354" height="1568" alt="image"
src="https://github.com/user-attachments/assets/fc217398-fd99-4665-b9bf-9ea0f6ed140b"
/>
---
Testing: manual
Fixes: servo#44995
Signed-off-by: pylbrecht <pylbrecht@mailbox.org>
Psychpsyo
pushed a commit
to Psychpsyo/servo
that referenced
this pull request
Oct 12, 2026
…ervo#47531) Building on top of servo#46931, this adds a new `out-of-tree` entry to the DOM memory report which automatically groups all memory for each previously-unmeasured WebIDL interface that is encountered when measuring the objects in the GC graph. Any object measured when traversing the tree is excluded from this, so we won't count any objects twice even if we add new grouping categories. Testing: No automated tests for about:memory at this time. --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
So far, all Rust memory for DOM objects ended up in a single category (MallocHeap).
To get a more fine-grained view into memory usage, we are now counting DOM object sizes:
For flexibility reasons, we do the counting within Servo instead of within SpiderMonkey.
When collecting memory reports from the script thread, we traverse each document and accumulate node sizes into
DocumentSizes. We remember, which nodes we already visited (ALREADY_COMPUTED_OBJECTS), and ignore these inget_size()to avoid counting them twice.Testing: manual
Fixes: #44995