Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Re: Large images/memort problem.

Reply
Thread Tools

Re: Large images/memort problem.

 
 
Jon Skeet
Guest
Posts: n/a
 
      07-08-2003
enclume42 <> wrote:
> I need to process scientific images within a Java program.
> I have to have simultaneously 2 images of 4400x8618 pixels
> (coded in 16-bits greylevels) in memory, to be loaded from
> an about 80 MB TIFF file. (The process later involves working
> on the DataBuffer obtained from the Raster of the BufferedImage,
> which works well with smaller images.)
>
> Unfortunately, when I try to load the image, the line
> image = ImageIO.read(file);
> of my code yields the following exception:
> Exception in thread "main" java.lang.OutOfMemoryError
>
> This is on a 1 GB RAM, 2 GB swap box.
>
> Questions:
> - Given the data about my images given above, is there a rule
> which allows the calculation a the memory required to load
> these images ?


I think it'll depend on how will ImageIO handles different formats - it
may well be that it takes 4 bytes per pixel, if it converts everything
into ARGB.

> - What about the memory required to extract the DataBuffer
> and work with it ?
>
> - Any idea on how I could decrease the amount of memory needed ?
> (I could load partial-image DataBuffer, but the bottleneck now
> is the image loading...)


Do you definitely need to decrease the amount of memory needed? If the
problem is that your app is failing, the first thing to do is
*increase* the amount of memory available to the JVM. By default it's
only 64Mb. You can increase this using command-line parameters when
starting the JVM. For instance:

java -Xmx768M mypackage.MyClass

would start the JVM with a maximum heap size of 768Mb, which may well
be somewhat better for you...

--
Jon Skeet - <>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
 
Reply With Quote
 
 
 
 
enclume42
Guest
Posts: n/a
 
      07-09-2003
This did it. Thanks a lot.

> > - Any idea on how I could decrease the amount of memory needed ?
> > (I could load partial-image DataBuffer, but the bottleneck now
> > is the image loading...)

>
> Do you definitely need to decrease the amount of memory needed? If the
> problem is that your app is failing, the first thing to do is
> *increase* the amount of memory available to the JVM. By default it's
> only 64Mb. You can increase this using command-line parameters when
> starting the JVM. For instance:
>
> java -Xmx768M mypackage.MyClass
>
> would start the JVM with a maximum heap size of 768Mb, which may well
> be somewhat better for you...

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
median of large data set (from large file) friend.05@gmail.com Perl Misc 5 04-02-2009 04:06 AM
wireless lan for three computers within a large corporate network =?Utf-8?B?bWFza2Fs?= Wireless Networking 7 02-04-2005 09:17 PM
How do people build large wireless networks? SA Dev Wireless Networking 1 08-25-2004 02:30 PM
[Urgent] Is there a size limit on returning a large dataset or a large typed array from web service? Ketchup ASP .Net Web Services 1 05-25-2004 10:11 AM
Backing Up Large Files..Or A Large Amount Of Files Scott D. Weber For Unuathorized Thoughts Inc. Computer Support 1 09-19-2003 07:28 PM



Advertisments