Out of Memory error- Problem!

R

rooban

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
 
M

Murray

rooban said:
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
 
S

Stu

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.
 
A

Anand Gopinath

+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
 
J

jackie

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.
 
S

Stefan Waldmann

Anand said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,439
Members
44,829
Latest member
PIXThurman

Latest Threads

Top