Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / September 2004

Tip: Looking for answers? Try searching our database.

Tomcat out of memory

Thread view: 
Dale - 27 Sep 2004 18:51 GMT
I've a situation where Tomcat is crashing with an out of memory error
every 24-48 hours. I think I may have narrowed down the cause: we have
tens of thousands of jsp pages, and every time one of them is compiled
i see the heap size grow, and it never shrinks back down. Eventually
Tomcat becomes unresponsive, writes out of memory to the catalina log,
and I have to restart it. Here's what I'm running:

RedHat Linux ES 3.0
Apache 2.0.46 with ( mod_jk )
Tomcat 4.1.24
Sun j2sdk 1.4.2_03

My question is, I've explicitly set it in the web.xml configuration so
that Tomcat forks javac processes to another memory partition. Even
so, I'm seeing out of memory reported by Tomcat. Is this a memory leak
in javac, Ant, or is my original hypothesis incorrect?

thanks,
Dale
William Brogden - 27 Sep 2004 19:23 GMT
> I've a situation where Tomcat is crashing with an out of memory error
> every 24-48 hours. I think I may have narrowed down the cause: we have
[quoted text clipped - 15 lines]
> thanks,
> Dale

Tomcat 5 release notes contain this:
-quote-
--------------------
JAVAC leaking memory:
--------------------

The Java compiler leaks memory each time a class is compiled. Web  
applications
containing hundreds of JSP files may as a result trigger out of memory  
errors
once a significant number of pages have been accessed. The memory can only  
be
freed by stopping Tomcat and then restarting it.

The JSP command line compiler (JSPC) can also be used to precompile the  
JSPs.

Note: This issue has been fixed in Sun JDK 1.4.x.
-endquote-

Bill
Dale Lum - 27 Sep 2004 19:52 GMT
> Tomcat 5 release notes contain this:
> -quote-
[quoted text clipped - 15 lines]
> Note: This issue has been fixed in Sun JDK 1.4.x.
> -endquote-

Yes, I've read that. I am running the 1.4.2 JDK. I've also set javac to
fork. The Tomcat docs have this to say about that:

fork - The internal JVM javac compiler used by Ant has a known memory
leak. And Ant requires that java compiles be synchronized, i.e. only one
JSP page can be compiled at a time. Set fork to true or do not define it
(it is the default value) so that Ant compiles JSP pages in a seperate
JVM. This removes the synchronization of JSP page compiles and prevents
all the javac classes from being instantiated and subsequently garbage
collected by the JVM Tomcat is running in. This also works around known
issues with javac, including memory leaking, as well as JAR file locking
on Windows.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.