$ docker run --rm --memory=256m --entrypoint java flags-demo:jdk25 \ -Xlog:gc -Xmx1g -cp /memoryhog.jar MemoryHog 24 200 $ echo "exit code: $?" $ docker inspect --format "OOMKilled={{.State.OOMKilled}} ExitCode={{.State.ExitCode}}" [0.005s][info][gc] Using Serial MemoryHog starting: chunk=24MB sleep=200ms [0.054s][info][gc] GC(0) Pause Young (Allocation Failure) 1M->1M(7M) 0.685ms held=24MB heapUsed=25MB heapMax=989MB freeHeap=6MB [0.296s][info][gc] GC(1) Pause Young (Allocation Failure) 25M->25M(31M) 1.057ms held=48MB heapUsed=49MB heapMax=989MB freeHeap=6MB [0.513s][info][gc] GC(2) Pause Young (Allocation Failure) 49M->49M(77M) 0.606ms held=72MB heapUsed=73MB heapMax=989MB freeHeap=27MB [0.728s][info][gc] GC(3) Pause Young (Allocation Failure) 73M->73M(112M) 0.184ms held=96MB heapUsed=98MB heapMax=989MB freeHeap=14MB [0.959s][info][gc] GC(4) Pause Young (Allocation Failure) 98M->97M(147M) 15.593ms held=120MB heapUsed=122MB heapMax=989MB freeHeap=24MB [1.180s][info][gc] GC(5) Pause Young (Allocation Failure) 122M->121M(181M) 15.364ms held=144MB heapUsed=146MB heapMax=989MB freeHeap=35MB held=168MB heapUsed=170MB heapMax=989MB freeHeap=11MB [1.634s][info][gc] GC(6) Pause Young (Allocation Failure) 170M->169M(251M) 34.003ms held=192MB heapUsed=194MB heapMax=989MB freeHeap=56MB held=216MB heapUsed=218MB heapMax=989MB freeHeap=32MB container exit code: 137 error: no such object: hogB