What's the difference between StackOverflowError and OutOfMemoryError

后端 未结 11 1471
不知归路
不知归路 2020-12-04 09:07

What\'s the difference between StackOverflowError and OutOfMemoryError and how to avoid them in application?

11条回答
  •  既然无缘
    2020-12-04 09:32

    StackOverflowError : Thrown when a stack overflow occurs because an application recurses too deeply.

    OutOfMemoryError : Thrown when the Java Virtual Machine cannot allocate an object because it is out of memory, and no more memory could be made available by the garbage collector.

提交回复
热议问题