Out of Memory error- Problem!

Discussion in 'Java' started by rooban, Jun 11, 2004.

  1. rooban

    rooban Guest

    Hi all I have designed a Image query and retrieval system based on
    colour content. I'm using a database to retrieve the images from. The
    problem I'm having is that I can't store a large amount of images in
    to this database. When i tried to store around 1000 images (around 17
    - 20MB total capacity) i'm getting this error:

    java.lang.outofMemoryError
    Exception occured during event dispatching:
    java.lang.OutOfMemoryError.

    the system basically starts storing the images in the database but
    about 3/4 way after it stops and displays the above message!! I looked
    for solutions for this problem on the web and i have been told it was
    due to the heap size limitations. how can i solve this problem? Please
    give me a step by step solution. thanks
    Rooban
     
    rooban, Jun 11, 2004
    #1
    1. Advertising

  2. rooban

    Murray Guest

    "rooban" <> wrote in message
    news:...
    > Hi all I have designed a Image query and retrieval system based on
    > colour content. I'm using a database to retrieve the images from. The
    > problem I'm having is that I can't store a large amount of images in
    > to this database. When i tried to store around 1000 images (around 17
    > - 20MB total capacity) i'm getting this error:
    >
    > java.lang.outofMemoryError
    > Exception occured during event dispatching:
    > java.lang.OutOfMemoryError.
    >
    > the system basically starts storing the images in the database but
    > about 3/4 way after it stops and displays the above message!! I looked
    > for solutions for this problem on the web and i have been told it was
    > due to the heap size limitations. how can i solve this problem? Please
    > give me a step by step solution. thanks
    > Rooban


    Assuming you're unable to make any easy adjustments to your code to make it
    more memory-efficient, you may need to increase the max heap size for the
    JVM. I think for most platforms the default is 64MB which isn't a lot if
    you're dealing with images I guess. Specify the -Xmx<size> parameter when
    loading the JVM. e.g. java -Xmx256M
     
    Murray, Jun 11, 2004
    #2
    1. Advertising

  3. rooban

    Stu Guest

    On 11 Jun 2004 11:19:05 -0700, (rooban) wrote:

    >Hi all I have designed a Image query and retrieval system based on
    >colour content. I'm using a database to retrieve the images from. The
    >problem I'm having is that I can't store a large amount of images in
    >to this database. When i tried to store around 1000 images (around 17
    >- 20MB total capacity) i'm getting this error:
    >
    >java.lang.outofMemoryError
    >Exception occured during event dispatching:
    >java.lang.OutOfMemoryError.
    >
    >the system basically starts storing the images in the database but
    >about 3/4 way after it stops and displays the above message!! I looked
    >for solutions for this problem on the web and i have been told it was
    >due to the heap size limitations. how can i solve this problem? Please
    >give me a step by step solution. thanks
    >Rooban



    By database do you mean an external db like mySQL etc or just your own
    implementation of an in-memory database?

    I'm guessing the latter since presumably you'd only be limited by disk
    space if you were storing BLOBs in an actual database.

    So assuming it's an in-memory 'database', how about keeping the actual
    images as files rather in all in-memory. So your in-memory database
    info would just be the content analysis - probably smaller than the
    actual image (?). If the content info is big too, you may have to
    stash it as well and access as needed.

    May have to do some kind of paging - where you load smaller chunks of
    the database at a time for searching through.
     
    Stu, Jun 11, 2004
    #3
  4. +java.lang.outofMemoryError
    +Exception occured during event dispatching:
    +java.lang.OutOfMemoryError.
    +
    +the system basically starts storing the images in the database but
    +about 3/4 way after it stops and displays the above message!! I looked
    +for solutions for this problem on the web and i have been told it was
    +due to the heap size limitations. how can i solve this problem? Please
    +give me a step by step solution. thanks
    +Rooban

    You want to pass in something like this in your java call:

    java -Xms256m -Xmx256m -cp classpath package.name

    That will ask java to use 256MB. By default i think it is some small
    value like 2MB. Xms is the initial amount of memory allocated, Xmx is
    the maximum allowed. You can change the values according to your needs
    and specs on the system running the application.

    Anand Gopinath
     
    Anand Gopinath, Jun 11, 2004
    #4
  5. rooban

    jackie Guest

    I suspect it is a program bug. If the image is being updated one by one,
    there should be no problem of memory limitation as Java will GC
    automatically when necessary. Of course this approach is a bit slower and
    "inidividual image size too big" is another matter. It is alos possible to
    think about using inputstream but it will take more time to implement and
    simply putting the image into a single Object.

    Storing images is not an easy task. Try hard.

    Anand Gopinath <> wrote in message
    news:...
    > +java.lang.outofMemoryError
    > +Exception occured during event dispatching:
    > +java.lang.OutOfMemoryError.
    > +
    > +the system basically starts storing the images in the database but
    > +about 3/4 way after it stops and displays the above message!! I looked
    > +for solutions for this problem on the web and i have been told it was
    > +due to the heap size limitations. how can i solve this problem? Please
    > +give me a step by step solution. thanks
    > +Rooban
    >
    > You want to pass in something like this in your java call:
    >
    > java -Xms256m -Xmx256m -cp classpath package.name
    >
    > That will ask java to use 256MB. By default i think it is some small
    > value like 2MB. Xms is the initial amount of memory allocated, Xmx is
    > the maximum allowed. You can change the values according to your needs
    > and specs on the system running the application.
    >
    > Anand Gopinath
     
    jackie, Jun 12, 2004
    #5
  6. Anand Gopinath wrote:
    > You want to pass in something like this in your java call:
    >
    > java -Xms256m -Xmx256m -cp classpath package.name
    >
    > That will ask java to use 256MB. By default i think it is some small
    > value like 2MB.


    No, by default it's 64MB.

    Regards,
    Stefan
     
    Stefan Waldmann, Jun 15, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page