Linux で、メモリのサイズを調べる方法

次のように、free、cat /proc/meminfo 等、いろいろな方法がある(以下は、Amazon EC2 スモールインスタンスの例)。

# free
             total       used       free     shared    buffers     cached
Mem:       1747764    1733596      14168          0     109416    1162984
-/+ buffers/cache:     461196    1286568
Swap:       917496        128     917368

# cat /proc/meminfo
MemTotal:      1747764 kB
MemFree:         18916 kB
Buffers:        109608 kB
Cached:        1157404 kB
SwapCached:          0 kB
Active:        1242560 kB
Inactive:       406980 kB
HighTotal:     1003528 kB
HighFree:         5156 kB
LowTotal:       744236 kB
LowFree:         13760 kB
SwapTotal:      917496 kB
SwapFree:       917368 kB
Dirty:             116 kB
Writeback:           0 kB
AnonPages:      382528 kB
Mapped:          62420 kB
Slab:            39188 kB
SReclaimable:    24684 kB
SUnreclaim:      14504 kB
PageTables:       5344 kB
NFS_Unstable:        0 kB
Bounce:              0 kB
CommitLimit:   1791376 kB
Committed_AS:   722640 kB
VmallocTotal:   114680 kB
VmallocUsed:      1496 kB
VmallocChunk:   112984 kB

# dmesg | grep Mem (システム起動時のメモリ状態)
  HighMem    186366 ->   437248
  HighMem zone: 1960 pages used for memmap
  HighMem zone: 248922 pages, LIFO batch:31
Memory: 1711020k/1748992k available (2071k kernel code, 28636k reserved, 1080k data, 188k init, 1003528k highmem)

トラックバック URL: https://perltips.twinkle.cc/trackback/328
Posted on 2008-04-29 by yas |