我用 C++ 编写了一个程序,使用英特尔 C++ 编译器对其进行编译,并在 Mac OSX 下运行它。
我想分析程序的最大内存使用情况,我会使用什么工具?
出于脚本目的,我更喜欢命令行工具。
最佳答案
虽然我没有尝试过,Valgrind Massif profiling tool应该有助于做到这一点。从 Massif manual :
By default Massif measures only heap memory, i.e. memory allocated with malloc, calloc, realloc, memalign, new, new[], and a few other. Therefore, the numbers reported by Massif may be significantly smaller than those reported by tools such as top that measure a program's total size in memory. However, if you wish to measure all the memory used by your program, you can use the --pages-as-heap=yes.
关于c++ - 如何在 OSX 中获取程序的最大内存使用量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9680766/