-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add stack-measuring functionality #15600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
If I'm reading those numbers correct, is that indicating that a task is using 8 gigabytes of stack? Rust tasks currently do not have resizable stacks, and they're allocated through two different means:
Instrumenting the runtime to hook into all task spawn events is also possible, I've toyed around with it for servo with logging events here: https://github.com/stamourv/rust-task-visualizer/blob/master/rtinstrument.rs Does that help? |
No, only 8 MiB. |
Feel free to ping me on IRC if you need any help! I'm acrichto. |
(Alex gave me the following instructions on how to do this.) Yes, this will currently require instrumentation of Servo to work.
This may require a newer version of rust than servo has available, so |
Seems like this has been resolved. |
It hasn't been resolved. I just measured again with current Servo tip:
That's over 48 MiB of stack, which is more than a third of Servo's total Rss. |
Oh, I just learned that if a non-thread-stack mapping is placed adjacent to a thread stack, the two will be merged and /proc//smaps will claim that the merged result is a thread stack. So these big numbers are bogus. Good. |
…t-in-ra, r=Veykril fix: ensure `rustfmt` runs when configured with `./` (Hopefully) resolves rust-lang/rust-analyzer#15595. This change kinda approaches canonicalization—which I am not a fan of—but only in service of making `./`-configured commands run correctly. Longer-term, I feel like this code should be removed once `rustfmt` supports recursive searches of configuration files or interpolation of values like `${workspace_folder}` lands in rust-analyzer. ## Testing I cloned `rustc`, setup rust-analyzer as suggested in the [`rustc` dev guide](https://rustc-dev-guide.rust-lang.org/building/suggested.html#configuring-rust-analyzer-for-rustc), saved and formatted files in `src/tools/miri` and `compiler`, and saw `rustfmt` (seemingly) correctly.
I've done some memory profiling of Servo (by looking at
/proc/<pid>/smaps
on Linux) and found that stack sizes can be really large:These are all |Rss| values. The |Size| values (i.e. address space taken) values were even larger.
It would be nice to have language (well, library) support for measuring these within the Rust code. I don't know how it would be implemented, though.
The text was updated successfully, but these errors were encountered: