java virtual machine and native method stacks stack memory overflow causes the phenomenon and Solutions

java virtual machine stack and native method stacks memory model are described methods performed while performing each method, and creates a stack frame, the stack frame information for storing local variable table and the like. Each method call to the completion of the execution procedure, it corresponds to a stack frame to push the stack in a virtual machine process stack.

Memory overflow of reasons:

Too many call the method, more than the memory area, such as multiple recursive and the like.

Memory overflow phenomenon:

(1) request thread stack depth is greater than the maximum allowable depth stackoverflowerror, usually single thread will appear this phenomenon.

(2) the virtual machine at the time of application to extend the stack can not be enough memory outofmemoryerror: unable to create new native thread, usually when there will be multi-threaded, thread stacks to share memory resources, resulting in memory becomes smaller.

Solutions:

The rational allocation of stack size, you can set the size of stack memory by -Xss128k.

Published 415 original articles · won praise 434 · views 210 000 +

Guess you like

Origin blog.csdn.net/qq_41901915/article/details/103515279