Trigger OOM Killer with a minimal example?
nobeh5 at gmail.com
Sat Sep 5 12:07:47 UTC 2015
I have been trying to create a minimal example/setting to be able to
the Unix OOM Killer.
Here is the general scenario that I follow:
1. Setup up a machine with `X` MB of memory
2. Configure the machine to have `Y` MB of swap space
3. Run the Java example
4. Observe in `dmesg` the killing happens
For (1), I use a small virtual machine on VB using Ubuntu 14.04.03-server
with X ~= 1000MB memory
```3.19.0-26-generic #28~14.04.1-Ubuntu SMP Wed Aug 12 14:09:17 UTC 2015
x86_64 x86_64 x86_64 GNU/Linux```
For (2), I use a small script to make the necessary swap space with Y = 64MB
For (3), I use a small Java example at:
and this is how I run the program (to preserve our live environment
I have three "types" of observations:
Type1: OOM Killer triggered
Sometimes, the example indeed leads to triggering OOM Killer with the
[ 8072.902446] Out of memory: Kill process 2619 (java) score 865 or
[ 8072.904516] Killed process 2619 (java) total-vm:2214952kB,
Type2: VM failure with an hs_ error log
Other times the run leads to the following error message:
Java HotSpot(TM) 64-Bit Server VM warning: INFO:
os::commit_memory(0x00000000f4400000, 111149056, 0) failed; error='Cannot
allocate memory' (errno=12)
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 111149056 bytes for
committing reserved memory.
# An error report file with more information is saved as:
I can provide the logs if necessary.
Type3: OutOfMemoryError: Java heap space
And, sometimes, the program actually exits with an OutOfMemoryError
[ 1825] *** ERROR ***
java.lang.OutOfMemoryError: Java heap space
Having said the above, I understand that "consistently" triggering OOM
Killer can be hard considering OS configurations and runtime state.
If it is possible to do this, what am I missing? How can I "consistently"
make the program killed by OOM Killer?
More information about the jdk9-dev