What is best way to figure out memory usage for a set of programs? (I have nine python programs running.) Do I need to use pmap and have something compare what shared memory is used in each and then deduct all duplicates?
As far as I understand, the ps output may have duplicated details. Memory: 583M Act, 158M Inact, 52K Wired, 27M Exec, 660M File, 7248K Free Swap: 1025M Total, 120M Used, 905M Free Totals for ps -awwwxo %mem,rss,rsz,tsiz,vsz are: %MEM RSS RSZ TSIZ VSZ 15.1 135296 135296 9380 2007060 $ vmstat -s | egrep 'bytes per page|pages manage|pages free$|cached file pag|cached executab|swap page' 4096 bytes per page 218477 pages managed 3877 pages free 166878 cached file pages 6929 cached executable pages 262275 swap pages 30610 swap pages in use Now to look at my python daemons: $ ps -awwwxo pid,%mem,rss,rsz,tsiz,vsz,comm | egrep "PID.*COMM|python" PID %MEM RSS RSZ TSIZ VSZ COMMAND 9866 0.5 4612 4612 8 118244 /usr/pkg/bin/python3.1 11797 0.5 4460 4460 8 131720 /usr/pkg/bin/python3.1 1334 0.6 5052 5052 8 113132 /usr/pkg/bin/python3.1 6242 0.5 4600 4600 8 125488 /usr/pkg/bin/python3.1 9657 0.9 8448 8448 8 112096 /usr/pkg/bin/python3.1 14447 0.3 3116 3116 8 128588 /usr/pkg/bin/python3.1 18240 0.3 2692 2692 8 145024 /usr/pkg/bin/python3.1 18558 0.5 4860 4860 8 126188 /usr/pkg/bin/python3.1 19478 0.5 4348 4348 8 134984 /usr/pkg/bin/python3.1 How can I know if the memory use above is accurate or not in regards to shared code? Anyway for pmap to join the output or recognize duplicates? Or do you know of another script to understand the pmap output? (I see that when I look at various processes with pmap -a, that there are overlapping or identical Start-End sections.) I am trying to understand this, as now my three main NetBSD systems are nearly always using lots of swap and they are becoming much slower. Thanks