File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes Tomcat out of memory with some JREs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat out of memory with some JREs" Watch "Tomcat out of memory with some JREs" New topic

Tomcat out of memory with some JREs

mikael eriksson

Joined: Aug 24, 2006
Posts: 1
I have a peculiar memory problem with Tomcat under certain JREs and JDKs.

I run winxp sp2, tomcat 5.5.12 as a service and mysql 5.0.18.
I have set the tomcat and java environment variables.

On one machine using jre 1.5.0_08 results in out of memory very quickly running the webapps. Switching to jdk 1.5.0_08 does not help. On another machine the same settings results in proper behaviour.

I think there is some problem with how JVM sets memory to Tomcat. The screw-up came when I was playing with these min/max memory settings. However when I set it back as it was, the screw-up is still there.

I can't find the tomcat5w.exe settings somewhere in the registry. Can I check somewhere which settings really is set for Tomcat?
Bart Saelen

Joined: Aug 18, 2006
Posts: 9
I have a simular problem

when running tomcat 4.1.24 as a service with JDK 1.4.2 i get out of memory regulary. I also changed the memory settings.

It happens only on the production server (win 2003) and not on the testmachine (also win 2003)

Do you really think there is a problem with Tomcat setting JVM memory?
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

If the problem is a memory leak in your app then allocating more heap space will only postpone the out of memory crash.
If it isn't and your app just needs more memory than the 64k default, the raising it will fix the problem.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Simon Joseph Aquilina
Ranch Hand

Joined: Feb 14, 2006
Posts: 102
How could there be a memory leak in Java? I had the same problem, I increased the size of the heap. So far it seems to be working. However I do not know how could there be a leak in Java, since the GC should run and remove all objects that have no reference. And there should be a lot of objects wothout a reference after the request.

I am definitly sure I am saying something stupid (sorry). But isn't what i said true?

Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Nope, not saying anything stupid.

It is possible to create memory leaks in Java (though you have to work a little harder at it).

The most common case in a database driven webapp is caused by failing to return database connections to the connection pool.
Every hit that needs a connection will pull one from the pool. If it doesn't return it when it's done, then the pool will keep growing.
GC will never be able to collect the connection objects because there are still references to them in the pool.
[ September 02, 2006: Message edited by: Ben Souther ]
Simon Joseph Aquilina
Ranch Hand

Joined: Feb 14, 2006
Posts: 102
Thanks Ben,

I understand what you say. I will keep that in mind

Thanks and Regards,
subject: Tomcat out of memory with some JREs
Similar Threads
JBoss in Action Permgen Out of Memory Error
Out of memory after 14 hr operation
Tomcat memory leak
tomcat on vista