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

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