At the end of this post is the script I'm using to measure vs_exe's "private" memory. At the moment I have only 6 small files open and the files that are part of my project are not changing. If I hit "Refresh" and immediately run the script I see the following progression:
$ python memusage.py 5504
private dirty: 333652 kB
shared dirty: 10520 kB
$ python memusage.py 5504
private dirty: 347664 kB
shared dirty: 10520 kB
$ python memusage.py 5504
private dirty: 364356 kB
shared dirty: 10648 kB
$ python memusage.py 5504
private dirty: 373896 kB
shared dirty: 10648 kB
$ python memusage.py 5504
private dirty: 385896 kB
shared dirty: 10648 kB
$ python memusage.py 5504
private dirty: 400912 kB
shared dirty: 10664 kB
Regards,
Iker
import platform
import sys
def get_mem_usage (pid):
smaps = '/proc/%s/smaps' % pid
raw = open(smaps, 'r').read()
status = {}
private_dirty = 0
shared_dirty = 0
for line in [i for i in raw.split('\n') if i ]:
line = line.strip()
if not line: continue
k, v = (line.split(':')+["", ""])[0:2]
if k.strip() == 'Private_Dirty':
private_dirty += int(v.strip().split()[0])
if k.strip() == 'Shared_Dirty':
shared_dirty += int(v.strip().split()[0])
return private_dirty, shared_dirty
if __name__ == "__main__":
priv, shared = get_mem_usage(sys.argv[1])
print "private dirty: %d kB" % priv
print "shared dirty: %d kB" % shared