Hello,
Java Gurus,
I have a
JSP program which uses JavaBean to process data from
a database and outputs the result. I am running into
some memory problems. When I run the JSP program through
Internet Explorer, I usually monitor the memory used by
the process "java.exe". My memory problem is related to
the process "java.exe". Here is the detail:
Sometimes, because of the data returned from the database,
the JSP program will crash. When this happens, depending
on the data being processed, the process "java.exe" may
take quite large amount of memory (say 400k). I would
assume that since the JSP program has crached, garbage
collector will sneak out to mop the space once in a while.
But in my case, this never happens. If I rerun
the same JSP program again without restarting
Tomcat,
then the memory taken by this process "java.exe" will start
to increase from where the previous crash left, i.e., 400k.
Of course, the same program will crash again, leaving
the memory taken by process "java.exe" to be about
doubling the previous amount, say 800k. This could
quickly clog the machine's memory and crash the webserver
(in my case, Tomcat).
Of course, if I stop Tomcat and then restart after each
jsp crashes, there will be no memory problem described
above.
My question to all you Java Jurus are:
(1) Why would this happen?
(2) How could I fix this, i.e., how could I ensure that
whenever a JSP program crash, the memory taken
by itself will be available for garbage collection,
or be collected by the system (without stopping Tomcat)?
I would appreciate any commects, suggestions, etc.
Sam