写一个shell来不停的消耗系统内存,来进行测试。
#!/bin/bash
mkdir
/tmp/memory
mount
-t tmpfs -o size=1024M tmpfs
/tmp/memory
sleep
3600
rm
/tmp/memory/block
umount
/tmp/memory
rmdir
/tmp/memory
执行结果
![](https://images2018.cnblogs.com/blog/1323575/201806/1323575-20180606161955517-1061154030.png)
写一个shell来不停的消耗系统内存,来进行测试。
#!/bin/bash
mkdir
/tmp/memory
mount
-t tmpfs -o size=1024M tmpfs
/tmp/memory
sleep
3600
rm
/tmp/memory/block
umount
/tmp/memory
rmdir
/tmp/memory