You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by fachhoch <fa...@gmail.com> on 2013/05/21 16:53:30 UTC

permgen space increases every day

My application running on tomcat ,every day I see an increase in permgen
space, does this ever garbage collected? how can I see whats in the permgen
space? I guess Heap dump shows whats in the heap memory, how about permgen
space , I want to know why its increasing everyday? 
Tomcat 6.35 jdk 1.6 

Note# I am not redeploying any application in tomcat and I just have my app
and not even the manager app.I always restart the server if I have to
redeploy my app. 
Please advice .



--
View this message in context: http://tomcat.10.x6.nabble.com/permgen-space-increases-every-day-tp4999275.html
Sent from the Tomcat - User mailing list archive at Nabble.com.

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


Re: permgen space increases every day

Posted by fachhoch <fa...@gmail.com>.
Thanks for the reply.

do you ever actually run out of 
PermGen space, or are you just particularly worried about it happening? 

Yes I did ran out of PermGen space.
So I am checking frequently whats the perm gen  size and I see its
increasing   every day.
Thanks I will try out you suggestion.





--
View this message in context: http://tomcat.10.x6.nabble.com/permgen-space-increases-every-day-tp4999275p4999396.html
Sent from the Tomcat - User mailing list archive at Nabble.com.

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


Re: permgen space increases every day

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Facchoch,

On 5/21/13 12:23 PM, fachhoch wrote:
> Thanks for your replies, I  use spring , hibernate , wicket. For
> some of my objects I create proxy   using spring, hibernate
> creates proxies  and injection into wicket objects uses spring
> proxy. I also  use groovy   with spring  and most of my groovy
> beans are of scope prototype.
> 
> 
> 
> <lang:groovy  id="someId" 
> script-source="classpath:com/../..LeadAnlystReturnedAssignmentEmail.groovy"
>
> 
scope="prototype" />

I think it's memory profiler time. The good news is that you should be
able to do it all for free (i.e. no cash).

First, read about how to enable profiling directly in the JVM:
http://docs.oracle.com/javase/7/docs/technotes/samples/hprof.html

(Hint: you want the heap=dump or heap=all options)

Or, you can take a heap snapshot (probably easier) using jmap like this:

$ jmap -dump:live,format=b,file=heap-dump.hprof.bin [pid]

(Where [pid] is of course the process id of your JVM)

Once you have a .hprof file, you can either try to use HAT (which
while providing lots of useful information is not terribly intuitive)
or you can use Eclipse's Memory Analyzer Tool (which I've never used,
but I have heard that it is fantastic).

I personally use YourKit (full disclosure: YourKit gives free licenses
to ASF committers so I have a free license) which I find quite good.

> Whats the best way I can force tomcat to garbage collect  my
> permgen, I am running tomcat with -Xmx1024m -Xmx1024m
> -XX:MaxPermSize=1024m

Any full GC will clean PermGen as much as possible. Unless disabled,
calling System.gc() should request a full GC, but it's not guaranteed.
Enable GC logging to find out what is being collected and when.

I suspect that if you are seeing PermGen free-space shrink all the
time and full GCs are occurring (they do happen, though infrequently
as they are kind of time-consuming) then you are really just filling
it up with "useful" stuff.

The question is: how can you reduce it so used-PermGen doesn't grow
without bound.

You never answered my question: do you ever actually run out of
PermGen space, or are you just particularly worried about it happening?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRnNWaAAoJEBzwKT+lPKRY35wP/0saW8nRZBAkU0d1QyEwiZV4
sequ/mpkK9X4M0o+9Q+o9m71iM0mX1HT+juBs05mji2jmTFQQLvGaXRlUghJiXQy
3r00cPZ4ytfTGgo88JOfi2pfCf3g1S2WiyYT4eocqxwG8jDZ/9HuQYCnvK8dFk3K
eVP5vyQbdypzOwc80tfiRbd7jcSwGOnVgiEFvQ/dlKYxry6u0n+Q9hAh1DHmYrz0
vtIwB0dGU+yh1NtCAg90zwa3tlKum50AX4gfpeAS9TOsboAN+GY46r+maeH+Djih
RD6kj/zsZ7uIt8v3F0IvGwlzi+awsuilu6fTyNSJxOXObw5EM2Omv7NHLOLlKyvL
P3C8dd5+G0nE2A2PqcIDGq41CQaitMrmlgLTnynKx3AgB3fSmn3qKSe89pKUpvK/
gqNOGq+QO8HzQmFK4D504greO5SB+5NYqoB2k+Y5b/MVlCoknVxWF1M09yuvXtr8
ZFnASSoZzbhlex06k1OD9u/5SqWe9GdNH7fm289AlywydQfYYlmts9vXnwmyvtnO
Ue7jEpou9Znl+w1pHuzhmCN9h+WgT3APB/Bx1GvoJuTEeMlI/aUGcxBLXhLC348G
kaougOhJsoP+GVVFFljfJXoslGtfLvtvbTe670EqPRdg1y0L5jbe308wq9Z76jea
56B1Tb3gAKy0puZwHrBs
=bpRa
-----END PGP SIGNATURE-----

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


Re: permgen space increases every day

Posted by fachhoch <fa...@gmail.com>.
Thanks for your replies, I  use spring , hibernate , wicket.
For some of my objects I create proxy   using spring, hibernate creates
proxies  and injection into wicket objects uses spring proxy.
I also  use groovy   with spring  and most of my groovy beans are of scope
prototype.



<lang:groovy  id="someId"
script-source="classpath:com/../..LeadAnlystReturnedAssignmentEmail.groovy"
scope="prototype" />


Whats the best way I can force tomcat to garbage collect  my permgen, I am
running tomcat with 
-Xmx1024m -Xmx1024m -XX:MaxPermSize=1024m










--
View this message in context: http://tomcat.10.x6.nabble.com/permgen-space-increases-every-day-tp4999275p4999284.html
Sent from the Tomcat - User mailing list archive at Nabble.com.

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


Re: permgen space increases every day

Posted by Jess Holle <je...@ptc.com>.
Note:

If you use various things like RMI and CMS GC and don't set one or two 
key properties you'll always have a perm gen leak.

It's a nice feature of CMS :-)

On 5/21/2013 10:44 AM, Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Fachhoch,
>
> On 5/21/13 10:53 AM, fachhoch wrote:
>> My application running on tomcat ,every day I see an increase in
>> permgen space
> What was PermGen usage after your webapp reached a steady-state
> (usually a few minutes after launch)? How much does it grow every day?
> Have you ever run out of PermGen or are you just concerned that you
> /might/ run out?
>
>> does this ever garbage collected?
> Yes.
>
>> how can I see whats in the permgen space?
> Use a memory profiler.
>
>> I guess Heap dump shows whats in the heap memory, how about
>> permgen space , I want to know why its increasing everyday?
> I believe heap dump does give you PermGen info, but the "mat" tool
> might not be great for visualizing it.
>
>> Tomcat 6.35 jdk 1.6
>>
>> Note# I am not redeploying any application in tomcat and I just
>> have my app and not even the manager app.I always restart the
>> server if I have to redeploy my app.
> That is good information to have. Do you do anything with RMI or use a
> lot of proxy classes or anything like that? PermGen is mostly filled
> with java.lang.Class objects. The more classes you have loaded, the
> more PermGen you need. If you generate lots of on-the-fly Class
> objects and their instances don't get collected, then the
> java.lang.Class objects stick around forever and fill-up your PermGen.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQIcBAEBCAAGBQJRm5ZPAAoJEBzwKT+lPKRYTawQAJc0t5BGRSAtOtFcL/gNMi70
> dsxOvL0FOXbYBcM5WE3OXOyPYMiHxQVGqe5tBTwcZrkF+cQ64V+tITrJvmRlHPMT
> D9TjQNBgIvI5oFX4Ik8gcCxBgEW823Nn6+Qqa7ZKIrcMCNRi76hfGYfuXopJyD0I
> WgsjKvbB8hgZbrCsN7uF5jfpf6CD6ataXO35jYB/Na1RAZ9az4Me5Q7Ray67svvw
> XY0frWD6I7oUmsfyvuwNlXkdCoB6SWZDGjqn7d/3pzFhEqUi5Th5N/qeQkKNX3kk
> gMc5Mt5jvd358Odc3gh4kdpbgo+BuBuEg6nXhlehhhMSvYHrbY/hNNkRhybQej3v
> wxLK7NY90o/i2hQHo3SrXFt9HnVOG1JVBG/hT0K5saJH5DSoMULvJ/bLvCDvNwoR
> +lUW6p/zyY1rZKminKlF6wyj0Kn14oXMF7ueRCGIaP05H8fwvakuOfk21nTEFptN
> sn3jdrvvWMggZAWcjOKFVyBSxqAFAxTqikuYgE0Hjz82mj2L2GZl8cvKcqA8r34b
> k9GDnshZOFMuR9dfe9o4mzTMy/RAXNkLrB3ioqRE79dMy/e8PShLNgkmzPjbasoY
> aqNvYsXVMF1+HvuRw+XzliwCx2EdssGhk0yT4ZfvTH1PKMHPYRP89yy7SWf7HT5B
> CuHOTq7lKyvpur49BNm6
> =YlR/
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> 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


Re: permgen space increases every day

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Fachhoch,

On 5/21/13 10:53 AM, fachhoch wrote:
> My application running on tomcat ,every day I see an increase in
> permgen space

What was PermGen usage after your webapp reached a steady-state
(usually a few minutes after launch)? How much does it grow every day?
Have you ever run out of PermGen or are you just concerned that you
/might/ run out?

> does this ever garbage collected?

Yes.

> how can I see whats in the permgen space?

Use a memory profiler.

> I guess Heap dump shows whats in the heap memory, how about
> permgen space , I want to know why its increasing everyday?

I believe heap dump does give you PermGen info, but the "mat" tool
might not be great for visualizing it.

> Tomcat 6.35 jdk 1.6
> 
> Note# I am not redeploying any application in tomcat and I just
> have my app and not even the manager app.I always restart the
> server if I have to redeploy my app.

That is good information to have. Do you do anything with RMI or use a
lot of proxy classes or anything like that? PermGen is mostly filled
with java.lang.Class objects. The more classes you have loaded, the
more PermGen you need. If you generate lots of on-the-fly Class
objects and their instances don't get collected, then the
java.lang.Class objects stick around forever and fill-up your PermGen.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRm5ZPAAoJEBzwKT+lPKRYTawQAJc0t5BGRSAtOtFcL/gNMi70
dsxOvL0FOXbYBcM5WE3OXOyPYMiHxQVGqe5tBTwcZrkF+cQ64V+tITrJvmRlHPMT
D9TjQNBgIvI5oFX4Ik8gcCxBgEW823Nn6+Qqa7ZKIrcMCNRi76hfGYfuXopJyD0I
WgsjKvbB8hgZbrCsN7uF5jfpf6CD6ataXO35jYB/Na1RAZ9az4Me5Q7Ray67svvw
XY0frWD6I7oUmsfyvuwNlXkdCoB6SWZDGjqn7d/3pzFhEqUi5Th5N/qeQkKNX3kk
gMc5Mt5jvd358Odc3gh4kdpbgo+BuBuEg6nXhlehhhMSvYHrbY/hNNkRhybQej3v
wxLK7NY90o/i2hQHo3SrXFt9HnVOG1JVBG/hT0K5saJH5DSoMULvJ/bLvCDvNwoR
+lUW6p/zyY1rZKminKlF6wyj0Kn14oXMF7ueRCGIaP05H8fwvakuOfk21nTEFptN
sn3jdrvvWMggZAWcjOKFVyBSxqAFAxTqikuYgE0Hjz82mj2L2GZl8cvKcqA8r34b
k9GDnshZOFMuR9dfe9o4mzTMy/RAXNkLrB3ioqRE79dMy/e8PShLNgkmzPjbasoY
aqNvYsXVMF1+HvuRw+XzliwCx2EdssGhk0yT4ZfvTH1PKMHPYRP89yy7SWf7HT5B
CuHOTq7lKyvpur49BNm6
=YlR/
-----END PGP SIGNATURE-----

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