EJP wrote:Exactly that. For all you know the JVM is keeping the inactive thread handles for later use. People have fallen in the trap of comparing OS resources to JVM resources before; it just doesn't work that way.
I doubt that this is either a problem or a memory leak actually.
So I guess these threads are not freed.and then:
I don't base decision on guess work, just trying to understand.So which is it?
If I set Xmx to 760 MB and see a RSS for the java process of 2 GB, isn't that a memory leak?No it isn't actually: it is the use of a lot of memory. Not the same thing. If you saw a constant upward trend of memory usage and eventually OutOfMemoryErrors, that's a memory leak. And none of that has anything necessarily to do with threads.
Will jvm release those handles when there will not be any physical memory available?Java will release unreachble objects during garbage collection. That will have the side-effect of releasing system resource handles.
AlleT wrote:It does happen. On hundreds of thousands of applications.
Java will release unreachble objects during garbage collection. That will have the side-effect of releasing system resource handles
This does not happen: