简体   繁体   English

为jvm进程分配了多少内存

[英]how much memory is allocated to jvm process

total memory allocated to the jvm process is equal to the total heap, stack, native heap. 分配给jvm进程的总内存等于总堆,堆栈,本机堆。 i know there are commands for setting the minimum and maximum size limits on the heap. 我知道有用于设置堆的最小和最大大小限制的命令。

how about the total memory allocated to the jvm process, is there a limit on that or would it keep on increasing as the number of threads getting created increases. 分配给jvm进程的总内存如何,是否有限制,或者随着创建的线程数的增加,它会持续增加。

if there is no limit on the number of threads and since a new stack is created when a new thread is created, would this cause the jvm to keep on increasing its size till there is no more memory left in the RAM? 如果对线程数没有限制,并且由于在创建新线程时创建了新堆栈,这是否会导致jvm继续增加其大小,直到RAM中没有剩余的内存了?

The total heap. 总堆。 New threads use heap memory. 新线程使用堆内存。 You'll OOME if you have too many of them. 如果您有太多的话,您将会得到OOME。 Try it? 试试吧?

From what I know it's so. 据我所知是这样。 Thread stack is allocated in JVM stack and OS specific. 线程堆栈是在JVM堆栈和特定于OS的空间中分配的。

You can use -Xss to control the default stack size but not its upper limit. 您可以使用-Xss来控制默认堆栈大小,但不能控制其上限。

Interesting articles 有趣的文章

http://www.onkarjoshi.com/blog/209/using-xss-to-adjust-java-default-thread-stack-size-to-save-memory-and-prevent-stackoverflowerror/ http://www.onkarjoshi.com/blog/209/using-xss-to-adjust-java-default-thread-stack-size-to-save-memory-and-prevent-stackoverflowerror/

http://blog.codecentric.de/en/2010/01/the-java-memory-architecture-1-act/ http://blog.codecentric.de/zh/2010/01/the-java-memory-architecture-1-act/

http://book.javanb.com/java-threads-3rd/jthreads3-CHP-13-SECT-6.html http://book.javanb.com/java-threads-3rd/jthreads3-CHP-13-SECT-6.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM