I run top on busybox and it shows all processes and their virtual memory size.
How do I determine how much RAM is being used by each process?
I run top on busybox and it shows all processes and their virtual memory size.
How do I determine how much RAM is being used by each process?
On busybox, "ps" doesn't have a "-o" option, but "ps l" includes the RSS column.
If the underlying O/S is Linux, you can also get more specific details for a given process from:
cat /proc/PID/status
The output looks like this:
Name: ash State: S (sleeping) Tgid: 1990 Pid: 1990 PPid: 1 TracerPid: 0 Uid: 0 0 0 0 Gid: 0 0 0 0 FDSize: 32 Groups: 0 VmPeak: 1592 kB VmSize: 1592 kB VmLck: 0 kB VmPin: 0 kB VmHWM: 552 kB VmRSS: 552 kB VmData: 268 kB VmStk: 136 kB VmExe: 688 kB VmLib: 472 kB VmPTE: 16 kB VmSwap: 0 kB Threads: 1 SigQ: 14/340 SigPnd: 00000000000000000000000000000000 ShdPnd: 00000000000000000000000000000000 SigBlk: 00000000000000000000000000000000 SigIgn: 00000000000000000000000004804004 SigCgt: 00000000000000000000000000080002 CapInh: 0000000000000000 CapPrm: ffffffffffffffff CapEff: ffffffffffffffff CapBnd: ffffffffffffffff Cpus_allowed: 1 Cpus_allowed_list: 0 voluntary_ctxt_switches: 49 nonvoluntary_ctxt_switches: 15
In this list, VmRSS is the current resident set, and VmHWM is the resident set high-water-mark.
ps -o pid,user,vsz,rss,comm,args
The 4th column (rss) is the resident set size, the non-swapped physical memory used by a task, in kiloBytes.
ps -q pid -o rss=
this should work