Results 1 to 2 of 2
  1. #1
    Jamie is offline Member
    Join Date
    May 2007
    Posts
    60
    Rep Power
    0

    Default OutOfMemoryError while creating a new object of file with size more than 150 MB

    I have created an application which generates a report by getting the data from our archived files (.zip file).By the time, the application is reaching a file with size more than 150 mb, it is running out of memory while creating the object of that particular file. Can some one help me by telling if there is a way to resolve this issue?

  2. #2
    levent Guest

    Default

    If you're getting OutOfMemoryError, the simplest thing to try is to give the VM more memory at startup. For Sun's VM, I believe the default was 64 MB. You can increase this by using the -X args that control the heap size. For example:

    java -Xms128m -Xmx256m ... etc. ...


    This says start with 128 MB of heap, and allow it to grow up to 256 MB.

    One thing to consider, though, is do you need that much stuff in memory at once? A more intelligent approach might be to unpack the archive to the file system, and then read a file at a time or a line at a time or a whatever at a time is appropriate for the processing you need to do.

Similar Threads

  1. Creating a Comparable object
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-15-2008, 08:38 PM
  2. Creating a File object in Servlet
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-16-2008, 11:24 AM
  3. Object size
    By kavithas in forum New To Java
    Replies: 0
    Last Post: 11-30-2007, 01:00 PM
  4. size of a java object
    By ravian in forum New To Java
    Replies: 0
    Last Post: 11-12-2007, 10:19 AM
  5. Creating object of Type Object class
    By venkatv in forum New To Java
    Replies: 3
    Last Post: 07-17-2007, 04:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •