在Linux中记录内存占用

nev*_*int 6 unix linux memory-footprint

有没有办法记录内存占用?在某个过程完成后,我们仍然可以访问它.

我检查内存占用的典型方法是:

$ cat /proc/PID/status
Run Code Online (Sandbox Code Playgroud)

但是在这个过程结束后,它绝不存在.

Nat*_*man 5

你可以这样做:

watch 'grep VmSize /proc/PID/status >> log'
Run Code Online (Sandbox Code Playgroud)

当程序结束时,你会得到一段时间内的记忆足迹列表log.