-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Mac OS X Sierra: detect_leaks is not supported on this platform #1026
Comments
If you're using Apple Clang (the one that comes with Xcode) then this is expected. LSan isn't mature enough on macOS and is unsupported. You can build Clang from open-source to experiment with LSan on macOS. |
Any update on that ? It doesn't seem to work on Catalina neither after building clang with brew. |
it still doesn't work at 2020.. |
Apple clang version 12.0 (which comes on Catalina) doesn't support Anyone know if Big Sur supports it? |
I'm also getting this error (on 10.15.7 Catalina with This documentation says you can use
Is this documentation wrong? Also, I was using Can anyone clear up exactly what the status is and what's necessary to make it work? And, related, should I / can I use both |
Ran into this here now (2021), I'm following the instructions that say it works on Mac OSX.. If it simply is the case that the Apple-provided clang really does not support this, I think it should be updated in https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer otherwise people will continue to read "it works on Mac OSX". Building your own compiler toolchain (if that is a requirement) is not one of the most common things you do and might be good to state that it's not supported on the typical mac osx developer setup otherwise. |
Running Big Sur 11.5.2 (20G95) and Apple clang version 13.0.0 (clang-1300.0.29.3) for x86_64-apple-darwin20.6.0, Instruments, which is installed with XCode, can be launched separately against your running process in order to check for allocations and leaks. I am not sure how accurate it is since I can't run detect_leaks but it might be handy in a pinch. To launch Instruments, right click on XCode and select "show package contents", then navigate to /Applications inside the XCode folder and click on "Instruments". |
Your solution WORKED!! THANK YOU! I'm on an M1 Macbook Pro on Big Sur 11.6 using Clion 2021.3 . I installed LLVM from Homebrew and used my llvm Homebrew path instead of the MacOS one. I Also had to make sure I had the ++ at the end to use the C++ compiler instead of the C compiler my path was "/opt/homebrew/Cellar/llvm/13.0.0_2/bin/clang++" then i had to add Hopefully this helps anyone who was just as confuse as I was lol. |
@kubamracek do you know the status of LSan on OSX? |
I have Mac OS X Sierra 10.13
and do as described here:
https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer
$ cat memory-leak.c
#include <stdlib.h>
void *p;
int main() {
p = malloc(7);
p = 0; // The memory is leaked here.
return 0;
}
% clang -fsanitize=address -g memory-leak.c ; ASAN_OPTIONS=detect_leaks=1 ./a.out
==23646==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 7 byte(s) in 1 object(s) allocated from:
#0 0x4af01b in __interceptor_malloc /projects/compiler-rt/lib/asan/asan_malloc_linux.cc:52:3
#1 0x4da26a in main memory-leak.c:4:7
#2 0x7f076fd9cec4 in __libc_start_main libc-start.c:287
SUMMARY: AddressSanitizer: 7 byte(s) leaked in 1 allocation(s).
But receive the message:
What I do incorrent?
The text was updated successfully, but these errors were encountered: