如何验证Java线程堆栈大小是固定的还是有限的? [英] How to verify if Java thread stack size is fixed or limited?

查看:401
本文介绍了如何验证Java线程堆栈大小是固定的还是有限的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试验证Java堆栈大小是固定的(在开始时设置)还是有限的(增长到一定限制).我试图用一个简单的程序来测量这一点,该程序创建一定数量的线程(使用Xss集),但到目前为止,我仅发现RSS是针对每个进程的,并且出于明显的原因,知道堆大小在这里毫无意义.

I'm trying to verify if Java stack size is fixed (set at the beginning) or limited (grows to a certain limit). I'm trying to measure this with a simple program that creates a certain amount of threads (with set Xss) but so far I only discovered that RSS is per process and for obvious reasons knowing heap size is meaningless here.

推荐答案

在Oracle和OpenJDK中,堆栈大小是固定的,不会缩小或增长. 视平台而定,默认大小会有所不同.

In Oracle and OpenJDK stack sizes are fixed and do not shrink or grow. Depending on the platform, default sizes vary.

IBM J9的处理方式有所不同:堆栈大小受Java线程的上下边界限制.操作系统线程可以具有不同的堆栈大小.

IBM J9 handles this differently: Stack sizes are limited via a lower and upper boundary for Java Threads. OS threads can have a different stack size.

如果要估计使用的内存总大小,则必须知道正在使用的线程数,因为在Oracle/OpenJDK和J9上堆栈大小都是每个线程的.

In case you want to estimate the total size of memory used, you'll have to know the number of threads being used, as the stack sizes are per thread on both Oracle/OpenJDK and on J9.

这篇关于如何验证Java线程堆栈大小是固定的还是有限的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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