在执行 C++ 程序时,可能会出现如下错误:
==30350==ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new vs free) on 0x602000000970
#0 0x4a7f6d in free (/home/adonia/10_workspace/01_agora/rte/refine-protocol/out/linux/x64/smoke+0x4a7f6d)
0x602000000970 is located 0 bytes inside of 8-byte region [0x602000000970,0x602000000978)
allocated by thread T0 here:
#0 0x4d795d in operator new(unsigned long) (/home/adonia/10_workspace/01_agora/rte/refine-protocol/out/linux/x64/smoke+0x4d795d)
第1行给出错误原因是 operator new vs free
,操作符不对应。
第6行指出是使用的 operator new
,第2行指出是使用的 free
。