简体   繁体   English

我的java线程需要多少内存?

[英]How much memory does my java thread take?

Is there a way to find out how much memory my java thread is taking in the VM? 有没有办法找出我的java线程在VM中占用多少内存?

For example, using stack trace dump, or some other means. 例如,使用堆栈跟踪转储或其他一些方法。

Thanks 谢谢

Java threads use the heap as shared memory. Java线程使用堆作为共享内存。 Individual threads have their stack (the size of which you can set via the -Xss command line option, default is 512KB), but all other memory (the heap) does not belong to specific threads, and asking how much of it one specific thread uses simply does not make sense. 各个线程都有自己的堆栈(可以通过-Xss命令行选项设置其大小,默认为512KB),但是所有其他内存(堆)都不属于特定线程,并询问一个特定线程有多少使用根本没有意义。

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

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