View Full Version : Memory Bug on Big Images

29.05.2008, 11:59 AM
i've noted a bug when opening big .PSD images


The program can't allocate memory.

Now information about the file and some calculation.

The file is

22814 * 15553 = 354826142 pixels = 8515827408 bits @ RGB24 = 1015 Mbytes

So more or less the Memory needed to map the image is ~ 1Gig.

Now i have 2 Gigs Physical and on 32bits we have a 2Gig limit memory per process.

So teorically irfanview would have to be able to load the image, both because i have the physical ram and because even if i didn't have, the VirtualMemory would provide the additional needing.

At this point i'm wondering pheraps there are some problems in the memory allocation routine (made a strict physical memory request instead on relying on the vmem pool)?

This problem can be solved (pheraps switch to a vmem request if a physical mem request fail)? It would be great if i could use Irfanview to just print these images instead of open Photoshop.


Bhikkhu Pesala
29.05.2008, 12:33 PM
Have you tried turning off Undo in Properties, Misc 1?

29.05.2008, 01:26 PM
How much memory out of the 2 GB is actually available?

I've previously worked with 400 Meg pictures and the undo only allocated memory after an edit had been performed, not upon loading.

I've reproduced this issue with PSD and PCX. Upon loading IV allocates more memory (about 0.5x for PSD, and 1.0x for PCX), and, as soon as loading is complete, releases it. So you actually need about 1.5-1.7 Gigs free RAM to load this PSD. Uncompressed, PNG and JPEG does not seem to need additional RAM for loading.

Layers in PSD do not matter (IV reads only the composite). Undo on/off does not matter.

Windows swap memory is a no-go. You could start Photoshop ten times while IV would be still loading the picture using swap.

Photoshop uses its own "scratch disk" virtual memory, thats why it has no problems working with gigabytes of data. If you work with graphics that big, you should really consider adding more memory (3.n GB physical), so that IV alone can get 2 GB. RAM is dirt cheap today.

29.05.2008, 02:17 PM
Mmm, i see. I can say IV has a 1.5gig physical available (no applications loaded) to load a picture that could get 1Gig.

Anyway, i remember in the past having loaded similar picture with system with a 3G physical and moreover with the /3G option activated. And even in that case IV falls back to same error. Another thing i note is that the error is quite instant, something like if that's a fixed limit within irfanview itself so with a simple
if (memoryrequested>n) error().

That's my impressions. I would glad if some developers could clarify, or if it is a structural limiti of IV, to implement a kind of "Block loading" in order to load the picture block by block and render it in realtime (reading the requested block from disk) instead of loading all the bytes and resize from ram (and in this case not being able to load it at all). Quite the same method photoshop uses to operate on big images.

05.07.2008, 01:04 PM
I have the same problem, but with an even smaller image. When I try to load a .tif-file of about 250MB, a similar error message ("Decode error. Error: Can't allocate memory for result image(s)! Out of memory.") appears instantly.
According to my FreeRAM program running concurrently, there is anywhere between 1500 and 1600 MB available out of the total of 2048 MB installed.
I have switched off the undo option in Properties/Misc. 1, as suggested above; also I unchecked the Preview-option when selecting the image.
BTW: this error also appeared in my previous version of IV, which was 3.95, I believe.
I would be very grateful for suggestions to resolve this issue.

Bhikkhu Pesala
05.07.2008, 02:57 PM
Hard to say what the cause is. No doubt it could be improved.

I managed to load a 66 Mbyte TIF image easily, resized it 200% it to over 344 Mbytes, and reloaded it. I have 1 Gbyte of fitted RAM over 900 Mbytes free.

I then resized the 66 Mbyte file by 300% and saved it successfully (uncompressed) at 775 Mbytes, but I cannot currently load it again. Maybe after a reboot I will be able to.

So how much memory your system has free may not be an indication of how much IrfanView can use. Maybe it needs even more RAM if the image is compressed.

05.07.2008, 04:53 PM
Compressed JPEG and PNG files don't need more RAM. Other formats for some reason do. But I have not tried TIFF.