我想查看command
. 我有一个参数化算法,我想知道程序何时会因我的机器(12GB RAM)上的内存不足错误而崩溃。
我试过了:
/usr/bin/time -f "%M" command
valgrind --tool=massif command
第一个给了我1414168
(1.4GB;感谢ks1322指出它以 KB 为单位!)而 valgrind 给了我
$ ms_print massif.out
--------------------------------------------------------------------------------
n time(i) total(B) useful-heap(B) extra-heap(B) stacks(B)
--------------------------------------------------------------------------------
75 26,935,731,596 22,420,728 21,956,875 463,853 0
我有点困惑我应该取哪个数字,但让我们假设“总数”(22MB)。
向massif-visualizer
我展示
现在我为同一个命令有 3 个不同的数字:
valgrind --tool=massif command
+ms_print
:22MBvalgrind --tool=massif command
+massif-visualizer
:206MB(这是我看到的htop
,我想这是我感兴趣的)time -f "%M" command
: 1.4GB
我应该看哪个数字?为什么数字完全不同?