$ docker run --rm --memory=256m -v $PWD/docker/memoryhog.jar:/memoryhog.jar --entrypoint java flags-demo:jdk25-jdk \
    -XX:MaxRAMPercentage=75 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/dumps/heap.hprof \
    -cp /memoryhog.jar MemoryHog 24 200

=== Diagnostic: -XX:+HeapDumpOnOutOfMemoryError actually leaves a dump behind ===
MemoryHog starting: chunk=24MB sleep=200ms
held=24MB heapUsed=25MB heapMax=185MB freeHeap=6MB
held=48MB heapUsed=49MB heapMax=185MB freeHeap=6MB
held=72MB heapUsed=73MB heapMax=185MB freeHeap=27MB
held=96MB heapUsed=98MB heapMax=185MB freeHeap=14MB
held=120MB heapUsed=122MB heapMax=185MB freeHeap=24MB
held=144MB heapUsed=146MB heapMax=185MB freeHeap=35MB
held=168MB heapUsed=170MB heapMax=185MB freeHeap=11MB
java.lang.OutOfMemoryError: Java heap space
Dumping heap to /dumps/heap.hprof ...
Heap dump file created [180390818 bytes in 1.028 secs]
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
	at MemoryHog.main(MemoryHog.java:21)
exit=1
total 176176
drwxr-xr-x 2 root root      4096 Oct  1 04:29 .
drwxr-xr-x 3 root root      4096 Oct  1 04:29 ..
-rw------- 1 root root 180390818 Oct  1 04:29 heap.hprof
