Mark

Thanks for taking the time to answer my questions.  Please see my response and 
questions below.

-----Original Message-----
From: Mark Thomas [mailto:ma...@apache.org] 
Sent: Thursday, July 14, 2016 2:58 PM
To: Tomcat Users List
Subject: Re: OutOfMemoryError: PermGen space

> On 14/07/2016 20:26, Berneburg, Cris wrote:
> 
> > Hi Folks
> > 
> > I got this error from the Tomcat Web Application Manager after having
> > stopped and started one of the applications multiple times.  (This was
> > after repeatedly deploying the application manually to attempt to find
> > a bug that I could not reproduce in my IDE.)  Once the error occurred,
> > the server was extremely sluggish to respond even to remote desktop
> > mouse and keyboard events.
> > 
> > [SNIP]
> > 
> > Here's the error:
> > 
> > FAIL - Application at context path /someapp could not be started FAIL 
> > - Encountered exception java.lang.OutOfMemoryError: PermGen space
> > 
> > Is this likely due to a memory leak in my application?
> 
> Yes.
> 
> >  Or does it have something to do with me doing so many repeated deployments?
> 
> Also yes.
> 
> >  Or perhaps simply from restarting the app so many times?
> 
> Stop/start has the same effect as redeploy in this case.
> 
> >  I might try an experiment to see how many times I can stop/start the
> > app before the error next occurs.
> > 
> > OS: Win Server 2012 R2
> > Java: 1.6.0_24  (oops, need to upgrade that now)
> > Tomcat: 6.0.37  (hmm... will need to upgrade soon-ish)
> 
> Indeed. Some upgrades are certainly in order. Not least because some of
> the potential sources of memory leaks are JVM bugs that are fixed in
> the lastest Java 8 releases.
> 
> This is probably a useful read:
> http://people.apache.org/~markt/presentations/2010-11-04-Memory-Leaks-60mins.pdf
> 
> Despite the age, it is still very relevant today.


Thanks for reminding me about that document.  It does sound relevant.  The 
document says,

> How memory leaks occur: Reference chains
> [...]
> Retaining a reference to a single object from a web application
> pins every class loaded by the web application in the Permanent
> Generation

Practically speaking, how is a reference retained?
1. Is a module-level (member) variable in a Servlet an example?
2. How about using ServletContext.setAttribute without an accompanying 
removeAttribute?
3. I see in one of my listeners some member (module-level) variables: a private 
static for the logger and also a protected final String.  Is that a problem?

If you could provide a little more guidance about the details, I would 
appreciate it.

> Mark

--
Cris Berneburg, Lead Software Engineer, CACI


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to