Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 00B991022E for ; Mon, 10 Feb 2014 20:52:14 +0000 (UTC) Received: (qmail 3379 invoked by uid 500); 10 Feb 2014 20:52:09 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 3289 invoked by uid 500); 10 Feb 2014 20:52:09 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 3280 invoked by uid 99); 10 Feb 2014 20:52:08 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Feb 2014 20:52:08 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of mr.botka@gmail.com designates 209.85.214.175 as permitted sender) Received: from [209.85.214.175] (HELO mail-ob0-f175.google.com) (209.85.214.175) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Feb 2014 20:52:02 +0000 Received: by mail-ob0-f175.google.com with SMTP id wn1so7807053obc.34 for ; Mon, 10 Feb 2014 12:51:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=MxrS14nWsQJL6rTx5aNsXa4ZKuxctrj5VO06kFUVMr4=; b=lZX5ClU+Nd0bZdjqRV7aGCsN2rrRmmyaDrqStw5ifg2PlvX93zMU8pNkUm9Y9gpDa/ o8Y49lfU18yWtENzW1roi8hRrWusNYAYKs0ARbPBbDLxPPdXdLZBNvM0sUyF+IntZMS9 +MRV7ZY+pBVIxM0yi02fc48DQEl3+Gb9Do0OcDmtQJ5bFe3EEeP7wStpXJwFbVT1uU1U Cxs2fSbYoVm7cjU7xxN0PcGCIC5xGbhuaqUnHPc9GngMZorWT8QuRUgqueNaR6MwKO+V A/j5y075onvOGqme8UeqIcjEZX1YqldYTsXhGrg1mKKzEELNsdHtbwZwCLLTEgjrw2kB LBeA== MIME-Version: 1.0 X-Received: by 10.60.165.72 with SMTP id yw8mr2081716oeb.71.1392065500880; Mon, 10 Feb 2014 12:51:40 -0800 (PST) Received: by 10.60.165.38 with HTTP; Mon, 10 Feb 2014 12:51:40 -0800 (PST) In-Reply-To: <52F4B974.3010302@apache.org> References: <52F40595.2090206@verizon.net> <52F4B974.3010302@apache.org> Date: Mon, 10 Feb 2014 21:51:40 +0100 Message-ID: Subject: Re: Tomcat classloader memory leak when an object is stored into session From: Michal Botka To: Tomcat Users List Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org On 07/02/2014, Mark Thomas wrote: > There is no leak. ... Hello Mark, thank you very mych for help and your great presentation. You were absolutely right, there was no memory leak :-) Obviously there was a different issue in my application causing the leak... I'm sorry for spamming. Best regards Michal P.S. Regarding the WebappClassLoader instances I'm suprised that there is quite often an instance with started=false remaining after garbage collection is performed. However, this instace is collected later as the used perm gen memory is reaching the maximum. 2014-02-07 11:46 GMT+01:00 Mark Thomas : > On 07/02/2014 06:38, Michal Botka wrote: >> Is there a way how to avoid this leak? > > There is no leak. > >> I would like to develop an application which can be safely >> deployed/undeployed without restarting the server. > > That is very much under your control. I'd suggest reading this: > http://people.apache.org/~markt/presentations/2010-08-05-Memory-Leaks-JavaOne-60mins.pdf > > as it highlights much of what can go wrong. > > >> OK, now I know that my application cannot store it's objects into >> session, but that is very strong requirement which the most of the >> applications don't meet. > > There is no such requirement. Storing objects in the session does not > trigger a memory leak on web application reload. > >> Thanks for help. >> >> 2014-02-06 22:58 GMT+01:00 David Kerber : >>> On 2/6/2014 3:13 PM, Michal Botka wrote: >>>> >>>> When an application stores an object into the session and then the >>>> application is reloaded using Tomcat Web Application Manager, the >>>> classloader cannot be garbage collected. As a result, the >>>> "OutOfMemoryError: PermGen space" error occurs after several reloads. >>> >>> >>> This is true. What is your question? > > No, this is not true. > >>>> To illustrate the issue, you can find an example below. >>>> Thanks in advance :-) > > I've taken the provided test code and confirmed - with a profiler - that > there is no memory leak. > > There is something else that is triggering your memory leak. Follow the > steps in the presentation above to find out exactly what it is that is > pinning the web application class loader in memory. > > Mark > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For additional commands, e-mail: users-help@tomcat.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org