当使用gcc编译器,添加-fsanitize=address -fsanitize=leak 这些编译标志后,直接运行程序./a.out
报错如下:
==12413==Sanitizer CHECK failed: ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:40 ((allocated_for_dlsym)) < ((kDlsymAllocPoolSize)) (1039, 1024)
解决办法:
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.2 ./a.out
程序运行正常。