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.