可能重复:
How to Test for Memory Leaks?
how to find memory leak in c++ code/project
How to find a memory leak in C++
Is there a good Valgrind substitute for Windows?查找内存的最佳解决方案泄漏
我有我的C++程序有很多内存泄漏。什么是解决方案(程序)来找到它们?
可能重复:
How to Test for Memory Leaks?
how to find memory leak in c++ code/project
How to find a memory leak in C++
Is there a good Valgrind substitute for Windows?查找内存的最佳解决方案泄漏
我有我的C++程序有很多内存泄漏。什么是解决方案(程序)来找到它们?
对于哪个操作系统?
在基于Linux的系统上,Valgrind。自由。
在基于Windows的系统上,Insure ++,Purify ....很多。
我喜欢用valgrind。假设g++
或clang++
,与-g
编译程序,并尝试:
valgrind --leak-check=full ./your_executable
最好的解决方案是实现现代化的计划。
new
和delete
。如果你在OS X man leaks
,泄漏Instrument或valgrind。随着程序的现代化,您可以使用这些来观察泄漏计数下降;)
请勿使用C++。对不起,无法抗拒:-D – 2012-01-12 11:01:47
@Thorsten:不,真正的snarky评论是“不要使用'new'”。 – 2012-01-12 11:02:54
[如何测试内存泄漏?](http://stackoverflow.com/questions/420599/how-to-test-for-memory-leaks),[是否有良好的Valgrind替代Windows?] (http://stackoverflow.com/questions/413477/is-there-a-good-valgrind-substitute-for-windows) – 2012-01-12 11:04:12