Return-Path: X-Original-To: apmail-tomcat-dev-archive@www.apache.org Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1DFF96A71 for ; Tue, 17 May 2011 00:18:05 +0000 (UTC) Received: (qmail 54328 invoked by uid 500); 17 May 2011 00:18:04 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 54257 invoked by uid 500); 17 May 2011 00:18:04 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 54244 invoked by uid 99); 17 May 2011 00:18:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 May 2011 00:18:04 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.115] (HELO eir.zones.apache.org) (140.211.11.115) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 May 2011 00:18:03 +0000 Received: by eir.zones.apache.org (Postfix, from userid 80) id E576748CCA; Tue, 17 May 2011 00:17:23 +0000 (UTC) From: bugzilla@apache.org To: dev@tomcat.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 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Tomcat 7 X-Bugzilla-Component: Manager X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: jhuxhorn@googlemail.com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: dev@tomcat.apache.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: https://issues.apache.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 https://issues.apache.org/bugzilla/show_bug.cgi?id=51195 --- 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 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