Java out of memory error - i am being careful but still get it! please help
I am trying to run my program and try to use as less as I can in terms of creating uneeded objects etc. But I get the
" java.lang.OutOfMemoryError: Java heap space" when I try to open a 9MB jpeg. I know that the file opens fine if i use only the module that opens and displays the file but for the overall program i run out of memory. I am pretty good on not declaring unused objects and opening the file is the first thing I do. Can someone help me out?
Thanks!
[482 byte] By [
shaselaia] at [2007-11-27 6:45:46]

> I am trying to run my program and try to use as less
> as I can in terms of creating uneeded objects etc.
> But I get the
> " java.lang.OutOfMemoryError: Java heap space" when I
> try to open a 9MB jpeg. I know that the file opens
> fine if i use only the module that opens and displays
> the file but for the overall program i run out of
> memory. I am pretty good on not declaring unused
> objects and opening the file is the first thing I do.
> Can someone help me out?
> hanks!
1) increase the memory your jvm can use
2) check to see if you aren't opening it more than once
If you're still getting the OutOfMemoryError, then try making it even bigger.
Try opening a very small image that you know isn't compressed or that you know is small even uncompressed.
Use a debugger or print statements to see if you're opening the file multiple times and keeping multiple copies around.
You need to do some detective work.
jverda at 2007-7-12 18:17:51 >
