c++ - 如何在 OSX 中获取程序的最大内存使用量

标签 c++ macos profiling

我用 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/

相关文章:

c++ - 将元素插入 multimap<string, vector<pair<string, int>>> 的语法

c++ - UBLAS 矩阵查找单元格的周围值?

c++ - Mac 上的自制 GLFW/GLEW

objective-c - 如何查找用户点击了 NSBrowser 中的任何行?

Android:跟踪创建的对象数

java - 如何在 Java VisualVM 中显示分析器选项卡?

c++ - Pancake Glutton 寻找数组中的最大值

objective-c - MacOS MTKView metal self.device.newBufferWithBytes 因断言而崩溃

python - python -v 命令的作用

silverlight - 性能分析 Windows Phone 7 应用程序 (SL/XNA)