Quick Linux Tip #12:
Try: watch -n 5 'ps -eo pid,user,vsz,rss,comm --sort=-rss | head -20'
Info: watch runs the command repeatedly, showing memory trends. RSS shows physical memory in KB. If a process's RSS keeps growing, you have a leak.
Examples:
- $ watch -n 1 'free -m'
- $ smem -tk -s rss # More accurate memory reporting
- $ sudo pmap -x 1234 | tail -1 # Detailed memory map
Note: smem is more accurate than ps for shared memory. Install with apt install smem. Monitor over hours to detect slow leaks.
Leave a Reply