$ docker run --rm --memory=256m --entrypoint java flags-demo:jdk25 \ -XX:-UseContainerSupport -XX:+PrintFlagsFinal -version | grep -E "MaxHeapSize|UseContainerSupport" $ docker run --rm --memory=256m --entrypoint java flags-demo:jdk25 \ -Xlog:gc -XX:-UseContainerSupport -cp /memoryhog.jar MemoryHog 24 200 --- what the flag alone resolves heap to --- size_t MaxHeapSize = 2105540608 {product} {ergonomic} size_t SoftMaxHeapSize = 2105540608 {manageable} {ergonomic} bool UseContainerSupport = false {product} {command line} --- the hog run --- [0.004s][info][gc] Using G1 MemoryHog starting: chunk=24MB sleep=200ms held=24MB heapUsed=26MB heapMax=2008MB freeHeap=101MB held=48MB heapUsed=52MB heapMax=2008MB freeHeap=75MB [0.515s][info][gc] GC(0) Pause Young (Concurrent Start) (G1 Humongous Allocation) 52M->51M(128M) 1.445ms [0.515s][info][gc] GC(1) Concurrent Undo Cycle [0.515s][info][gc] GC(1) Concurrent Undo Cycle 0.084ms held=72MB heapUsed=76MB heapMax=2008MB freeHeap=51MB [0.731s][info][gc] GC(2) Pause Young (Concurrent Start) (G1 Humongous Allocation) 76M->76M(128M) 1.569ms [0.732s][info][gc] GC(3) Concurrent Mark Cycle [0.748s][info][gc] GC(3) Pause Remark 101M->101M(172M) 0.580ms [0.749s][info][gc] GC(3) Pause Cleanup 101M->101M(172M) 0.018ms held=96MB heapUsed=101MB heapMax=2008MB freeHeap=70MB [0.751s][info][gc] GC(3) Concurrent Mark Cycle 19.274ms held=120MB heapUsed=126MB heapMax=2008MB freeHeap=45MB held=144MB heapUsed=151MB heapMax=2008MB freeHeap=45MB held=168MB heapUsed=176MB heapMax=2008MB freeHeap=45MB held=192MB heapUsed=201MB heapMax=2008MB freeHeap=45MB held=216MB heapUsed=226MB heapMax=2008MB freeHeap=45MB container exit code: 137