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?
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.
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?
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
Joined: Feb 14, 2006
I understand what you say. I will keep that in mind