消耗系统内存

写一个shell来不停的消耗系统内存,来进行测试。

#!/bin/bash

mkdir /tmp/memory
mount -t tmpfs -o size=1024M tmpfs /tmp/memory
dd if=/dev/zero of=/tmp/memory/block
sleep 3600
rm /tmp/memory/block
umount /tmp/memory
rmdir /tmp/memory
 
执行结果
 

原文地址:https://www.cnblogs.com/root0/p/9145756.html