Can someone please help me understand the output that I get from the top command? This is the point that the oom-killer is invoked and kills my main application. What exactly is under the VSZ and %VSZ? What is 502m304.5??

- 13
- 3
2 Answers
From http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ps.html:
vsz = "The size of the process in (virtual) memory in 1024 byte units as a decimal integer."

- 5,953
- 7
- 42
- 71
-
Thank you phk, however if you look at my output it has 502m304.5, what is that? – Cooli May 07 '16 at 14:14
Your output shows that top
is printing some escape sequences that the terminal doesn't recognize. The bits where you see a blank followed by [
followed by more garbage characters are escape sequences that work on most terminals; the first character of those sequences is the escape character, which your terminal prints as a blank. For example, ␛[7m
at the beginning of the title line starts inverse video, ␛[0m
stops inverse video, etc.
I'm not sure exactly what's going on with the STAT and VSZ column but it seems that top has printed some color-changing sequences there too (that's where the m
is coming from), and they've been partially overwritten (top is probably printing a ␈
character which does make the cursor go left so that the next character overwrites what was there).
With many programs, setting the TERM
environment variable correctly is enough: it should indicate a terminal type that doesn't support any escape sequences. Make sure that you don't have a script that hard-codes a value of TERM
somewhere. Try TERM=dumb
. If you're using BusyBox, I think its top
hard-codes escape sequences that work on most terminals, so you're out of luck. You could run it through a filter that removes escape sequences. Untested, but should work with BusyBox.
#!/bin/sh
script=$(printf 's/\033\\[[0-9;]*[A-Za-z]//g')
sed -e "$script" "$@"
(From this more complete Perl script)

- 829,060