Results 1 to 5 of 5
  1. #1
    hudrv is offline Member
    Join Date
    Sep 2011
    Posts
    2
    Rep Power
    0

    Default java.lang.OutOfMemoryError: Java heap space Workaround

    Hi,

    I am writing a Java application that processes a very large scientific data file. I am creating an array of 100 000 objects that contain various fields and java throws an "java.lang.OutOfMemoryError: Java heap space".

    Can anyone suggest me a workaround?

    BTW I've already increased the heap size to the physical maximum.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,433
    Blog Entries
    7
    Rep Power
    20

    Default Re: java.lang.OutOfMemoryError: Java heap space Workaround

    Quote Originally Posted by hudrv View Post
    Hi,

    I am writing a Java application that processes a very large scientific data file. I am creating an array of 100 000 objects that contain various fields and java throws an "java.lang.OutOfMemoryError: Java heap space".

    Can anyone suggest me a workaround?

    BTW I've already increased the heap size to the physical maximum.
    If there is no error in your program all that data simply may not fit in the available memory; if you can change your processing algorithm to an 'online' algotihm, i.e. read -> process -> output and forget about it, on a per object basis, that would be a solution; otherwise you have to chop up your input in more manageable parts ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    hudrv is offline Member
    Join Date
    Sep 2011
    Posts
    2
    Rep Power
    0

    Default Re: java.lang.OutOfMemoryError: Java heap space Workaround

    Isn't there a way to use memory caching in Java to increase available memoery size?

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,433
    Blog Entries
    7
    Rep Power
    20

    Default Re: java.lang.OutOfMemoryError: Java heap space Workaround

    Quote Originally Posted by hudrv View Post
    Isn't there a way to use memory caching in Java to increase available memoery size?
    There are lots of tricks that can postpone an OutOfMemoryError, but most (all?) of them are very specific to the problem at hand; you have to elaborate a bit on yours.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    fxRichard is offline Member
    Join Date
    Dec 2008
    Posts
    64
    Rep Power
    0

    Default Re: java.lang.OutOfMemoryError: Java heap space Workaround

    If you are using the max physical heap space possible then you need to change your design, like the others said this will be specific to your situation.

Similar Threads

  1. java.lang.OutOfMemoryError: Java heap space
    By kapil1089theking in forum Java Applets
    Replies: 1
    Last Post: 03-15-2011, 08:55 AM
  2. java.lang.OutOfMemoryError:Java heap space
    By newbiejava in forum New To Java
    Replies: 3
    Last Post: 08-22-2010, 09:00 AM
  3. Replies: 5
    Last Post: 08-13-2010, 10:04 AM
  4. java.lang.OutOfMemoryError: Java heap space
    By paul in forum Advanced Java
    Replies: 11
    Last Post: 06-12-2010, 05:30 PM
  5. java.lang.OutOfMemoryError: Java heap space
    By vidjogamer in forum New To Java
    Replies: 3
    Last Post: 02-06-2009, 06:52 AM

Posting Permissions

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