Linux command to create out of memory killer (OOM)

In linux ,when virtual memory(physical memory + swap) is used up ,OOM will kill one process to free memory.You can try below command to simulate an OOM

tail /dev/zero

After a while above command will use up all your virtual memory and been killed by OOM ,like below

user01@host01$ tail /dev/zero
Killed
user01@host01$

All you can get the relevant log messages via command dmesg

Out of memory: Kill process 15297 (tail) score 947 or sacrifice child
Killed process 15297, UID 1000001 (tail) total-vm:21404752kB, anon-rss:15804388kB, file-rss:4kB

Leave a Reply

Your email address will not be published. Required fields are marked *