我正在寻找一种简单的方法来衡量C ++应用程序使用的总内存。我知道valgrind,但最近我遇到了C ++的内存消毒剂。是否可以使用任何清理程序测量C ++可执行二进制文件使用的最大堆/堆栈内存?
答案 0 :(得分:1)
使用time -v
可以为您提供有关应用程序的大量有用信息:
System time (seconds): 0.00
Percent of CPU this job got: 0%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:05.00
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 2144
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 179
Voluntary context switches: 2
Involuntary context switches: 1
Swaps: 0
File system inputs: 0
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0