tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrievsky Dmaitry <>
Subject About possible memory leak in Tomcat 5.x
Date Mon, 19 Dec 2005 08:58:46 GMT
Hello users,

About a half a year ago I've found that my webapp works fine in
development environment, but leaks memory in production one.
I've searched through all the code, found a few minor errors, but it
didn't help.
(of course, tag pooling are disabled completely)

So then i've tried to use profiler, looking on alien classes.
(I've tried before too, but my attention was concentrated on my own classes)

And then i've found lots of
from which there were a lot of references to the objects, that i've
treated as dead.

All PageContextImpl's lived at

There are property of org.apache.jasper.runtime.JspFactoryImpl, named
USE_POOL, which rules pool usage, but it is private,
and i've not found any way to set it to "false" from outside.
Initially it's "true".

So, i've set it to "false" directly in code,
rebuilt tomcat and replaced files ${CATALINA_HOME}/common/lib/jasper-*.jar
from production environment with fresh ones.

So, it seems that the problem is successfully solved.
As far as I can see there no more memory leakage.

I think it would be useful to allow users to set property of
org.apache.jasper.runtime.JspFactoryImpl.USE_POOL from config files or
in any other way, without rebuilding entire tomcat application.

In fact, I think, it's not REAL memory leak - memory usage, may be,
will stop grow on some large value (2+ GB, when pool become full), but i have not such
amount of memory.
Now memory usage about 100-200 mb after full gc, depending on amount
of currently working users.

P.P.S What seems to me interesting.
Although before putting PageContextImpl into pool JspFactoryImpl calls
pc.release(), and inside the method all links must become null (or
not?..) and referenced objects must become available to gc, they are not.
May be it is the root of the problem?..

BTW disabling of pool solves the problem completely...

Best regards,
 Dmitry Andrievsky                  

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message