Román

Thanks for taking the time to reply and educate me.  :-)  Please see my 
ramblings below.

-----Original Message-----
From: Román Valoria [mailto:romanvalo...@gmail.com] 
Sent: Thursday, July 14, 2016 11:28 PM
To: Tomcat Users List
Subject: Re: OutOfMemoryError: PermGen space

> Cris:
> 
> Couple of things here.
> 
> First, you can use in any Java 6 Update 45 and above the Java Visual VM,
> to monitor in real time the memory utilization done by the Java virtual
> machine. This will show you both the Help and Perm Gen memory graphs.
> You can find this tool in the bin directory of any JDK.


Thanks for suggesting that.  I have never used the Java Visual VM before.  Upon 
trying it, I can't seem to get the tool to find Tomcat running, even when 
starting the tool with administrative privileges.  The only local application 
it sees is itself, VisualVM.  Tomcat is not visible to the tool running either 
as a Windows service nor by starting using startup.bat.

Having never used the tool before I suspect I have missed something very basic. 
 Hmm... Google says I need to enable JMX on Tomcat and then add the JMX 
connection to Visual VM.  No dice, still can't see Tomcat.  Java bug #7009828 
(http://bugs.java.com/bugdatabase/view_bug.do?bug_id=7009828) prevents Visual 
VM from connecting but says I can launch the tool with Java's temp directory 
matching Tomcat's temp dir (or something like that).  That did it!  Now Visual 
VM can see Tomcat.

I took a snapshot and heap dump, restarted my app 5x, then took another 
snapshot and heap dump.  The first dump is 25MB, and the second after all the 
restarts is 46MB.  The top 3 classes in both are java.lang.String, char[], 
java.util.HashMap$Entry.  How do I pinpoint where a potential problem is?

In Visual VM, under File, Compare Memory Snapshots, it does not see the 
snapshots I generated.  The snapshots appear to be extension *.apps, but the 
compare function looks for files with extension *.nps.  I don't know how to get 
the compare function to work.

Not sure where to go from here.  Got any suggestions?


> Second, you can issue some Java parameters to actually enlarge the
> PermGen memory allocation upon startup. Please refer to your java
> version documentation on Oracle and lookup for the -XX parameters.
> 
> You can start by enlarging your PermGen space and the monitor on the
> Visual VM the behavior, if you consistently run out of memory, then
> you may have a leak.
>
> Of course that you would be constrained by the fact of running a
> 32-bit or 64-bit Tomcat / Java environment.
> 
> 
> On Fri, Jul 15, 2016 at 2:26 AM, Berneburg, Cris J. - US < 
> cberneb...@caci.com> 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.
> >
> > FYI, I deploy the app by stopping it on the Tomcat web manager, 
> > deleting almost everything out of the app folder using file manager, 
> > copying the new files and folders in, then starting the app from the Tomcat 
> > manager.
> >
> > 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?  Or does it 
> > have something to do with me doing so many repeated deployments?  Or 
> > perhaps simply from restarting the app so many times?  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)
> >
> > --
> > Cris Berneburg, Lead Software Engineer, CACI
> >

--
Cris Berneburg, Lead Software Engineer, CACI

Reply via email to