0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

メモリの使用状況を正しく調査する(freeとかsarとかpsとか)

Last updated at Posted at 2018-01-31

freeとかtopの見方、覚えられなくてその都度調べて、わりと単純じゃなくて、正しく理解しようとして、その都度悩む。無駄だなぁ。
今回調べたことをここにまとめておこう。

freeコマンドで実質メモリ消費の確認する

実質メモリ使用量 = kbmemused - ( kbbuffers + kbcached )
つまり、-/+ buffers/cache: 行を確認する

参考

free, used, buffer, cachedの相関がよく分かる図があります
http://ossfan.net/setup/linux-04.html

sarコマンドでメモリ要件を確認する

sar -r -f [saファイル] で、kbcommit 列を確認する

プロセスごとのメモリ使用量を調べる

ps alx | awk '{printf ("%s\t%d\n", $13,$8)}' | awk '{m[$1]+=$2;c[$1]++;} END {for(i in m){ if(m[i]>0) printf("%10d %5d %s\n",m[i],c[i],i)}}' | sort -nr
表示は、メモリ合計(kB)、プロセス数、プロセス名。

参照元

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?