I'm using Clang to compile my project, on x86_64 OS X(MacOS 10.15.5 Catalina).
I want to identify exactly from which file, which function, which line causes memory leaks. I am trying to use Address Sanitizer, specifically Leak Sanitizer.
Here are flags that I'm using when compiling:
-Wall -Wextra -flto -O3 -march=native -ffast-math -fsanitize=address
It successfully compiles. However, when I try to use run-time flag ASAN_OPTIONS=detect_leaks=1
in order to enable Leak Sanitizer, I see the following error:
==26454==AddressSanitizer: detect_leaks is not supported on this platform.
Abort trap: 6
What am I doing wrong? How could I fix this?
Or, is there another good alternative to a Valgrind? Valgrind doesn't work for me because 1)I'm using the MacOS Catalina, 2)My program runs with an infinite loop. If I'm right, Valgrind displays messages after exiting the program, so it won't work.
I would appreciate it if anyone could give me advice on this issue.