-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Profile memory_usage is broken on Mac OS Monterey #12039
Comments
As you can see in the implementation, this feature uses some special memory allocator APIs which are only available on Linux and |
Note that there are some, potentially obsolete, reasons why we don't build with |
Thank you, building with --features jemalloc works. I would suggest re-visiting building with jmallock support for rust-analyzer, I found cache cleaning in apply_change.rs quite clean and if mac os users don't have cache cleaned it may lead to performance degradation for rust-analyzer users. |
You're not supposed to use that command unless you're debugging the memory usage. What do you mean by that? |
Actually, while it runs it produces the same number on Mac - it's a different number between before and after on Linux how it should.
with |
Adding two numbers doesn't really allocate anything. What exactly are you trying to do? |
still produces
same as above two numbers. |
It is possible that the memory allocation is optimized away by LLVM. Try adding |
|
Did you set the global allocator as in https://github.com/rust-lang/rust-analyzer/blob/master/crates/rust-analyzer/src/bin/main.rs#L20=? |
Thank you @lnicola, adding global allocator and jemallocator into dependencies/default features helped. |
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.
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
)The text was updated successfully, but these errors were encountered: