tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 51195] "Find leaks" reports a false positive memory/classloader leak
Date Tue, 17 May 2011 00:17:23 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=51195

--- Comment #2 from Joern Huxhorn <jhuxhorn@googlemail.com> 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
mistaken.

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
undeploy.
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 java.io.ObjectStreamClass$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: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message