Skip to content
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

How to get the advertised ram usage? #67

Open
thisRedH opened this issue Apr 4, 2024 · 0 comments
Open

How to get the advertised ram usage? #67

thisRedH opened this issue Apr 4, 2024 · 0 comments

Comments

@thisRedH
Copy link

thisRedH commented Apr 4, 2024

I dont know how to get the advertised 3kb ram usage and also dont see how this is possible considering you are using tokio.
I tested this using the sysinfo (0.30.8) crate and added these lines to src/service/server in fn service.

tokio::spawn(async {
    let mut system = sysinfo::System::new_all();
    let pid = sysinfo::get_current_pid().unwrap();
    loop {
        system.refresh_all();

        if let Some(process) = system.process(pid) {
            println!(
                "phisical {} kb, {} mb ; virtual {} kb, {} mb",
                process.memory() / 1000,
                process.memory() / 1000_000,
                process.virtual_memory() / 1000,
                process.virtual_memory() / 1000_000
            );
        } else {
            println!("Failed to get process information.");
        }
        tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
    }
});
  • When compiled on Windows 10 in release i get ~20500kb physical and ~14000kb virtual Memory
  • When compiled on Arch Linux i get:
    • using glibc ~5000kb physical and ~188500kb virtual Memory
    • using musl ~3000kb physical and ~70500kb virtual Memory

(compiled using cargo b --release)

Now dont get me wrong 3mb is extremly little ram, but still it isnt 3kb.
Am i doing something wrong or may there be a Typo in the README?

@thisRedH thisRedH changed the title How to get the advertised ram usage How to get the advertised ram usage? Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant