启用高版本gcc
source /opt/rh/devtoolset-11/enable
libasan编译选项
make EXTRA_CFLAGS="-O0 -g -fsanitize=address -fsanitize-recover=address -fno-omit-frame-pointer -static-libasan -DBUILD_DEBUG -UDPDK_MALLOC -DRTE_MALLOC_ASAN"
gpreftools编译选项
make EXTRA_CFLAGS="-O0 -g -fno-omit-frame-pointer -DBUILD_DEBUG -UDPDK_MALLOC -rdynamic -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free"
libasam运行时
设置环境变量,下文是systemd里的环境变量配置格式
Environment="LD_PRELOAD=/usr/lib64/libtcmalloc.so.4.1.2"
Environment="HEAPPROFILE=/var/Logs/app_heapprof.log"
Environment="HEAPCHECK=normal"
Environment="HEAP_PROFILE_ALLOCATION_INTERVAL=1024"
Environment="HEAP_PROFILE_INUSE_INTERVAL=1024"
Environment="HEAP_PROFILE_TIME_INTERVAL=10"
Environment="HEAPPROFILESIGNAL=31"
/usr/bin/my_app
greftools运行时
设置环境变量,下文是systemd里的环境变量配置格式
Environment="ASAN_OPTIONS=allow_addr2line=true:halt_on_error=true:help=0:log_path=/var/Logs/app_asan.log"
/usr/bin/my_app
标签:gpreftools,app,Environment,builtin,内存,fno,asan,环境变量 From: https://www.cnblogs.com/hugetong/p/18143279