我的java线程需要多少内存? [英] How much memory does my java thread take?

查看:104
本文介绍了我的java线程需要多少内存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法找出我的java线程在VM中占用多少内存?

Is there a way to find out how much memory my java thread is taking in the VM?

例如,使用堆栈跟踪转储或其他方法。

For example, using stack trace dump, or some other means.

谢谢

推荐答案

Java线程将堆用作共享内存。各个线程有自己的堆栈(可以通过 -Xss 命令行选项设置其大小,默认为512KB),但所有其他内存(堆)不属于特定的线程,并询问一个特定的线程使用多少是没有意义的。

Java threads use the heap as shared memory. 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.

这篇关于我的java线程需要多少内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆