tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 51195] "Find leaks" reports a false positive memory/classloader leak
Date Tue, 17 May 2011 00:17:23 GMT

--- Comment #2 from Joern Huxhorn <> 2011-05-17 00:17:23 UTC
Calling System.gc() is not enough at all since the caches in question contain
SoftReferences that are not collected until the VM is running out of memory.
This is the root of this whole issue. The references are not released, thus
causing the leak-warning.

System.gc() is already executed during/before "Find leaks" if I'm not entirely

The performance degradation is absolutely irrelevant since I'd like to see this
code executed on click of the "Find leaks" button and not in case of every
This isn't something you'd do in a production environment.
Clicking that button will result in a certain amount of performance degradation
caused by the System.gc(), anyway.

The patch itself would only be non-threadsafe if
a) the private class$Caches exists and
b) the implementation contains both fields and
c) the fields in question are not instances of ConcurrentMap but only Map

c) is not taken care of at the moment but this could easily be circumvented by
changing the if condition to if(value instanceof ConcurrentMap) or even
if(value instanceof ConcurrentHashMap).

Calling clear() on a ConcurrentHashMap is safe according to the documentation.
It won't interfere with any retrieval or update operations.
It's just not guaranteed, that the map is really empty with 100% certainty.

The code does nothing at all if a) or b) are not fulfilled.

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message