-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Lance,

On 3/4/19 10:49, Campbell, Lance wrote:
> Tomcat 9.x

Note that the answer to this is not Tomcat-specific.

> What is the easiest way to identify how much memory Tomcat/Java is 
> currently using from the Java stack -Xss ?  Not max but currently 
> being used.

Uh... there is no "maximum stack size". There is only "stack size".
Each thread gets a stack of exactly that size.

> Is there a particular statement I can put into a servlet to see
> what the current memory usage is of the stack?

RuntimeMXBean rbean = ManagementFactory.getRuntimeMXBean();

List args = rbean.getInputArguments();

Then look through them for "-Xss" and the accompanying size.

The "used stack size" is the number of live threads times that number.

I don't know if there is a way to check that it was effective, though.

For example, there may be multiple -Xss arguments and the JVM picks one
of them to use (probably the last one, but I don't know for sure).

Also, there may be some minimum / maximum size that will be chosen if
the number is not sane. Or there may be magic numbers like 0 or -1 that
mean "the default for the platform" or whatever.

YMMV.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlx+0DwACgkQHPApP6U8
pFhaRQ//e3GW8AlMVxve9LTljwvtHcZcaCsjA4UWyDyi14rLEu4aHClf5mRluxwE
F0cvsEThxFIv2mpvY0aijs9Vcu+Uf8qMEncks3LTEPxq5GUoRdTHvO4dIqQh2tLd
LVRKBMj7TqeSeQqGjmkgxFHf+F2iuOj34q3LGWzhVbHTn94JOka65nZx75auTySS
jv/+pQGTPjJ8WgGCI3NQIlkg4t7+46i2lWI/D3FhFi0h7uqmV31wly4p7Pz1KxZa
6veaGcutwU7V5brl2vF00AXZsQPSlTQYNLEAfvL87S1WrXWeRTel4Xu/PIPKGq3H
bDbGeC7fh0KR1Gu7sBNlc9ZPxZs57B250ouvkEJ6wj3VG9RA6/MpdCsES9Mv8Z3m
jiwizYnpE2aVKTlH5ID3NPlxH4mCKVl4xxV2JKPeSqBRhnQJkRWE06Mg9XaW6LMv
f1GO9TJ5DSL+Qyb+9i29qy47c9oPrOL4I/9ABOkPfDQzc7iUHdfvpZbKg0BCzgSN
s9vQbzhl32tsJCskjg8OqY7NfzmO8rbcDj90/q60ekCYIz1QzFtJpp6WDMYtbcmW
I9W8dErov/iZSrRpw8selIvjYjJ//2cJ4vm6m9NBg3euT4NasiywidByaF5kOEZE
l5vBcSbDM6/am6b/ukSvRBX33LT5brPv4JQa33haGsKHgNoqc34=
=ZIok
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to