I don't know how can I see memory leaks using CLion on MacOS Big Sur using CLion and I've tried these things:
Valgrind - which is not compatible with Big Sur
Leak Sanitizer from Clang - which apparently isn't compatible with MacOS according to a support guy from CLion
Inside CLion, I've written in CMakeLists.txt this command:
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -g")
then I've written in preferences menu -> sanitizers in Address sanitizer section:
detect_stack_use_after_return=1
Based on CLion support page, they said that Leak Sanitizer is included in Address sanitizer.
Valgrind Memcheck (CLion)Valgrind Memcheck is a tool for detecting memory-usage problems such as leaks, invalid memory access, incorrect freeing, and referencing undefined values.
The primary tools for detecting memory leaks are the C/C++ debugger and the C Run-time Library (CRT) debug heap functions.
You can see the amount of system memory being used on your Mac. In the Activity Monitor app on your Mac, click Memory (or use the Touch Bar) to see the following in the bottom of the window: Memory Pressure: Graphically represents how efficiently your memory is serving your processing needs.
Another update: The 1Blocker team just released an update to fix the memory leak issue by reverting back to the blue 1Blocker button in Safari as a temporary workaround. Apparently, the monochrome one caused the issues.
In the Activity Monitor app on your Mac, click Memory (or use the Touch Bar) to see the following in the bottom of the window: Memory Pressure: Graphically represents how efficiently your memory is serving your processing needs.
If you keep running out of memory on your Mac, it’s easy to determine which application or process is eating it up in Activity Monitor. This utility is included with every copy of macOS. Here’s how to check, and some things you can do to fix this issue. To get started, open Activity Monitor.
Assuming you have installed the xcode command line developer tools, open a terminal window in CLion and try the following command, where programname is the name of the program you are building:
leaks -atExit -- cmake-build-debug/programname
You get output something like this:
leaks Report Version: 4.0
Process 69522: 214 nodes malloced for 21 KB
Process 69522: 1 leak for 1008 total leaked bytes.
1 (1008 bytes) ROOT LEAK: 0x14c6067f0 [1008]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With