Wednesday, April 15, 2020

How to fill memory on Linux

The easy way to fill memory is to  fill /dev/shm via dd command

1) Fill shm with random data
while true ; do dd if=/dev/zero of=/dev/shm/fill bs=1k count=4024k; sleep 2; done
2) Monitor memory usig free command and you should see memory usage under "used" and "free" changing
while true ; do free -m ;  sleep 2;done
# free -m
              total        used        free      shared  buff/cache   available
Mem:           7822        1937         164        3920        5720        1650
Swap:          3583           0        3583

No comments:

Post a Comment