Friday, April 8, 2022

[SOLVED] Why is the number of threads in a java process different from the actual size of non-heap memory?

Issue

The sentences may be strange due to my lack of English knowledge Thanks to everyone who reads the question.

Hello?

I am running a java process on Centos7 and monitoring it with jconsole, but the number of threads currently created is different in non-heap memory size.

I know that one thread occupies 1mb by default, but even if 100thread is created, the size of non-heap memory is not 100mb. Why?


Solution

Non-Heap memory, as shown by jconsole, includes Metaspace, Compressed Class Space and Code Cache. In other words, it counts memory used by loaded classes and compiled methods. It has nothing to do with threads and stacks.



Answered By - apangin
Answer Checked By - Senaida (WPSolving Volunteer)