简体   繁体   English

Xcode,释放了多少内存分配?(Valgrind的替代品)

[英]Xcode, how many of memory allocations were freed?(Alternative of Valgrind)

I am using Xcode for debugging of my C program, and I want to make sure that all memory allocations has been freed when the program is finished. 我正在使用Xcode调试我的C程序,并且我想确保在程序完成时已释放所有内存分配。 However, I am not sure how can I see if there is any alloc that is left not freed. 但是,我不确定如何查看是否有任何未释放的分配。

I know that it is possible to do using Valgrind on machines running on Linux. 我知道可以在Linux上运行的计算机上使用Valgrind。 Would appreciate if someone suggests alternative for Mac OS X Yosemite 10.10.1 and it would be even better if there is a way of doing it on Xcode. 如果有人建议使用Mac OS X Yosemite 10.10.1的替代方案,并且如果在Xcode上可以做到这一点,那就更好了。

When I am looking at memory accumulation (not being released) I use the Xcode profiler and Heap Shot, see For HowTo use Heap Shot (now named Mark Generation) to find memory creap: bbum blog . 当我查看内存累积(未发布)时,我使用Xcode探查器和Heap Shot,请参阅“如何使用Heap Shot(现在称为Mark Generation)”来查找内存问题: bbum blog

Also see the memory diagnostics under "Edit Scheme""Diagnostics": Enable Scribble, Enable Guard Edges, Enable Guard Malloc and Malloc Stack. 另请参见“编辑方案”“诊断”下的内存诊断:启用涂抹,启用保护边缘,启用保护Malloc和Malloc堆栈。

valgrind is available on MacOS. valgrind在MacOS上可用。 See valgrind web site: "X86/Darwin and AMD64/Darwin (Mac OS X 10.9, with limited support for 10.8)." 请参阅valgrind网站:“ X86 / Darwin和AMD64 / Darwin(Mac OS X 10.9,有限支持10.8)。”

So, that looks a good alternative to valgrind on linux, if you want to use MacOS. 因此,如果您要使用MacOS,那似乎是linux上valgrind的不错选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM