• Post Reply Bookmark Topic Watch Topic
  • New Topic

java.lang.OutOfMemoryError  RSS feed

 
vishnu mohan
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

we r getting the following error during the process.
we r using IIS and tomcat server and we have 1GM of ram.
// what i have done in my jsp
end =get doc cout* from the db
count=100
start=1
do{
if(count > end){
count=end;
}
select col1,col2 from tbl1 where serial_no between "start" and "count"
{
here we r using search engine API's to get the field information's
process
and insert the value to another table ( lets table2)
}
start=count;
count=count+100;
}while(start!=end)
// end process

and we r having 40k doc's in the table. And my program run up 30k doc's
And during the process im getting the error like...

Internal Servlet Error:
javax.servlet.ServletException
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:508)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
at org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Ajp12ConnectionHandler.java:166)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:484)
Root cause:
java.lang.OutOfMemoryError
<>

can anyone give me some solution to fix this out.........
thanks and regards
vishnu
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried tweaking the heap size flags (-Xms and -Xmx) when you start Tomcat?
Simon
 
vishnu mohan
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no Simon, Let me know how to do that....
thanks...
 
Sean MacLean
author
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry if this is too simple a suggestion, but have you ensured that you're not getting into an infinate loop? This is, by far, the most cpmmon cause of an out of memory exception.
Sean
 
chanoch wiggers
Author
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
to tweak the heap size use
java -Xms256M -Xmx256M runthewebserver
the line above will increase the heap size from the default (64M i think) to 256. It will also help boot up of the server. If you dont care about boot up, then set the -Xms one to a lower amount for more reponsible memory allocation.
I think it is probably a infinite loop problem though - tweaking the heap size will only make you wait longer. Why dont you print out end to the screen, or log it somewhere and check that its not some rediculous size.
also is it possible that the result set size is so big its crashing the system?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!