is it possible to get the memory usage of the running application process or is the one from example retrieving its usage? #1086
-
|
Beta Was this translation helpful? Give feedback.
Answered by
GuillaumeGomez
Oct 2, 2023
Replies: 1 comment 1 reply
-
Yes you can by doing: use sysinfo::{get_current_pid, ProcessExt, System, SystemExt};
if let Ok(pid) = get_current_pid() {
let mut system = System::new_all();
if let Some(p) = system.process(pid) {
println!("{pid:?} uses {} bytes", p.memory());
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
GuillaumeGomez
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes you can by doing: