Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 07-05-2009
Member
 
Join Date: Jan 2009
Posts: 84
Java.lang.OutofMemory.Exception error

Hey Guys,

Recently i was trying to convert a file to my mysql database. When i was trying to convert the file which was around 150 mb in size, it showed me an error message that "Java.lang.Out of Memory.Exception" on my desktop screen. I don't but its not allowing me to convert that particular file to my mysql database. Can any body help me out to get rid of the above problem? Any kind of help on the above issue would be appreciated.

Thanks.
Reply With Quote
  #2  
Old 07-05-2009
Member
 
Join Date: Apr 2008
Posts: 1,948
Re: Java.lang.OutofMemory.Exception error

The JVM places an upper limit on the amount of memory available to the current process in order to prevent runaway processes gobbling system resources and making the machine grind to a halt. When reading or writing large spreadsheets, the JVM may require more memory than has been allocated to the JVM by default.This normally manifests itself as a java.lang.OutOfMemory exception. By default, each workbook allocates 5MB when created and allocates more memory in 5MB increments. These values can be changed by using class WorkbookSettings. Often the OutOfMemory exception can be removed by lowering these values (note that performance may suffer as a result). Alternatively, you can allocate more memory to the JVM using the -Xms and -Xmx options; e.g., to allocate an initial heap size of 10 MB, with 100 MB as the upper bound, you should start the JVM like this:java -Xms10m -Xmx100m MyClass In order to allocate more memory in this manner to servlets/JSPs, consult the help documentation for the Web Application Server.
Reply With Quote
  #3  
Old 07-05-2009
Member
 
Join Date: May 2008
Posts: 2,008
Re: Java.lang.OutofMemory.Exception error

Hey you can try have a look at your code, there could be a memory leek. Try to set variables to null, after sometime it will clear the memory. You can also look out for some loops in you code, which may also consume a lot of memory.
Reply With Quote
  #4  
Old 07-05-2009
Member
 
Join Date: Apr 2008
Posts: 2,001
Re: Java.lang.OutofMemory.Exception error

Most JVMs allocate memory on the heap for almost everything, except for reflective data. That is put in a separate location which is a section of the heap that is reserved for permanent generation. This gets easily filled up when you dynamically load an unload classes, or have a large number of classes. I simply added the following options to the java executable and all my worries were gone:-
Quote:
-XX: PermSize=256M -XX:MaxPermSize=256M
My entire command for Sun's JVM looks like this now:-
Quote:
java -server -Djava.awt.headless=true -Xms1024M -Xmx1024M
-XX: PermSize=256M -XX:MaxPermSize=256M
Hope so it may help you out to resolve the problem.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Java.lang.OutofMemory.Exception error"
Thread Thread Starter Forum Replies Last Post
Error ?Uncaught exception: java.lang.IndexOutofBoundsException? while accessing the SMS inbox in BB torch Emmeric Portable Devices 3 19-02-2011 03:20 AM
Exception in thread "main" java.lang.NoClassDefFoundError: [ClassName] Icarusul Software Development 5 20-10-2010 12:44 AM
Blackberry Pearl 8100- Uncaught Exception: java.lang.IllegalArgumentException Angelica Maria Portable Devices 4 08-04-2010 12:37 PM
Error - java.lang.NumberFormatException Vodka Software Development 5 05-03-2010 11:57 AM
Error message: Uncaught Exception java.lang.error Rum Portable Devices 5 06-01-2010 01:59 PM


All times are GMT +5.5. The time now is 04:22 AM.