C++ 内存泄漏排查

1、有core文件:通过gdb调试

2、通过dmesg命令可以看到堆栈信息

test $: dmesg | grep test
[10897156.978602] traps: test[3816950] general protection fault ip:13e9eb8 sp:7f837fbffd10 error:0
[10897156.978606] test[3816956]: segfault at 51db06ebfde9 ip 00007f84f52c07a3 sp 00007f838b3b70b8 error 4
[10897156.978609] test[3816988]: segfault at abd83afff8 ip 00007f84f5306037 sp 00007f837cfd49c8 error 6
[10897156.978611]  in test[400000+186a000]
[10948432.666435] test[763813]: segfault at 1514e208 ip 00007f2b6dce6b82 sp 00007f2a01c76b20 error 6 in libstdc++.so.6[7f2b6dc29000+eb000]

3、根据gcc自带的工具:asan。
http://www.cppblog.com/markqian86/archive/2018/06/14/215728.html

https://blog.csdn.net/TSZ0000/article/details/96301184

遇到库出现问题:
https://blog.csdn.net/yjk13703623757/article/details/53217377
根据dmeg的信息进行分析
https://blog.csdn.net/zhaohaijie600/article/details/45246569
没有core文件,查代码core位置
https://www.jianshu.com/p/005edc228033

posted @ 2022-01-14 17:31  小海哥哥de  阅读(454)  评论(0编辑  收藏  举报