Skip to content

Profile memory_usage is broken on Mac OS Monterey  #12039

Closed
@AlexMikhalev

Description

@AlexMikhalev

I noticed that profile memory_usage doesn't work on Mac, I extracted https://github.com/AlexMikhalev/profile and added simple basic example to illustrate.

use profile::memory_usage;
fn main() {

    let before = memory_usage().allocated;
    println!("Before {:?}",before.to_string());
    let result = 2 + 2;
    println!("After {:?}",memory_usage().allocated.to_string());
    assert_eq!(result, 4);
}
cargo run --example basic
   Compiling profile v0.0.0 (/Users/alexmikhalev/rust_code/profile)
    Finished dev [unoptimized + debuginfo] target(s) in 2.57s
     Running `target/debug/examples/basic`
Before "0b"
After "0b"

Works on Linux but doesn't work on Mac, which means caches are not cleaned up from here

rust-analyzer version: rust-analyzer version: 7d6fcbc 2021-12-06 stable

rustc version: (eg. output of rustc -V)

rustc -vV
rustc 1.60.0 (7737e0b5c 2022-04-04)
binary: rustc
commit-hash: 7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c
commit-date: 2022-04-04
host: x86_64-apple-darwin
release: 1.60.0
LLVM version: 14.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions