I have been missing the leaks messages for a long time now when I compile and run my code with -fsanitize=address
I just get this
a.out(45811,0x7ff856c70680) malloc: nano zone abandoned due to inability to reserve vm space.
or using leaks
a.out(46256,0x7ff856c70680) malloc: nano zone abandoned due to inability to reserve vm space.
a.out(46256) MallocStackLogging: could not tag MSL-related memory as no_footprint, so those pages will be included in process footprint - (null)
a.out(46256) MallocStackLogging: zone[0] is not the normal default zone so can't turn on lite mode.
Can't examine target process's malloc zone asan_0x1108535b8, so memory analysis will be incomplete or incorrect.
Reason: for security, cannot load non-system library /Library/Developer/CommandLineTools/usr/lib/clang/16/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
I have tried a lot of code with clear leaks here is an example
#include <stdlib.h>
int main(void)
{
char *str;
str = (char *)malloc(10*sizeof(char));
str[0] = 'a';
str[1] = 0;
exit(0);
}
I compile the code like this
cc -Wextra -Wall -Werror -fsanitize=address main.c
and I get this response
user@MacBook-Pro-de-User test % ./a.out
a.out(45811,0x7ff856c70680) malloc: nano zone abandoned due to inability to reserve vm space.
(I have also tested it with leaks
and it does not show any leaks.)
I noticed this when I ran another code in a system with ubuntu that gave me a leak but in macos it doesn't return any leak, does anyone know why?