c - Leaks are not displayed in macos - Stack Overflow

I have been missing the leaks messages for a long time now when I compile and run my code with -fsaniti

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?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744978286a4604280.html

相关推荐

  • c - Leaks are not displayed in macos - Stack Overflow

    I have been missing the leaks messages for a long time now when I compile and run my code with -fsaniti

    1天前
    50

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信