What happens when the JVM runs out of memory to allocate during run time?

前端 未结 5 1807
难免孤独
难免孤独 2020-12-15 05:37

After thinking for a long time of a generic way to pose this question (and failing to find one) I\'m just going to ask it as a concrete example:

Suppose I have a Lin

5条回答
  •  暖寄归人
    2020-12-15 06:26

    -Xmx just defines the maximum size of the heap. It makes no guarantee on wether there is so much memory or not. It only ensures that the heap will never be bigger then the given value. That said, Option B.) will happen, an outOfMemoryError will be thrown.

提交回复
热议问题