メモリ消費テスト
2130 ワード
今日メールを読んでいると、ある大神がメモリをすばやく消費する方法を2つ提供してくれたことに気づきました.
ご参考まで
Here's 2 commands you can run on a test system that will consume a significant
amount of memory without installing any additional software.
host:~ # dd if=/dev/zero of=/dev/null bs=1T
where bs (block size) is around the size of your memory commit limit (cat
/proc/meminfo and note CommitLimit). Of course you can use any value you like
depending on how much memory you want to use. If you specify too large of a
value it will fail to allocate the buffer.
Also you can just tell bash to consume as much memory as possible with a
command line like this:
host:~ # A=0; while true; do A="$A$A"; done
-bash: xrealloc: cannot reallocate 18446744071562068096 bytes (0 bytes
allocated)
It will keep running until it consumes so much memory it fails to allocate
anymore for its internal buffer.
ご参考まで