Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Out of Memory Error

 
brisk rook
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an application with JSP as front end & Java to perform the business logic. I have a data file(flat file) which has around 600000 lines of data. when I was coding i used some 10000 lines of data from original data file. Everything was working well and i got the desired output. But when i tried using the Original data file (with 600000 lines) i got the following exception ..... can anyone help me in resolving this..i tried to increase the default & maximum heap size of the VM ..it din't work...

Ctx( /myApps ): Exception in: R( /myApps + /model.jsp + nu
ll) - javax.servlet.ServletException
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:399)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:4
04)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372
)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.
java:797)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743
)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnectio
n(HttpConnectionHandler.java:210)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:
416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java
:498)
at java.lang.Thread.run(Thread.java:484)
Root cause:
java.lang.OutOfMemoryError
<<no stack trace available>>
thanks in advance..
br
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seems to me that 600,000 x chars per line * 2 bytes per UNICODE character amounts to a pretty large amount of memory if you are storing String objects. How about making a byte[] to hold the file - saves all that String creation.
If your 600,000 line file is bigger than memory then you will need to use random access anyway.
Bill
------------------
author of:
 
What could go wrong in a swell place like "The Evil Eye"? Or with this tiny ad?
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!