Windows – file size limit in Paint.NET

crashpaint.netwindows

I can open smaller tifs no problem, but these tifs at 100+MB cannot be opened in Paint.NET. I don't think it's memory issue, because other software can open with no problems (IrfanView, XNViewPortable). Is this a software limitation?

"There was an unspecified error while opening the file."

http://dl.dropbox.com/u/1156285/PaintDotCrash_OpenBifTif.avi

I'm using Paint.NET v3.5.5 (Final Release build 3.55.3767.28608) on XP SP3.

Update:

I think Joel Coehoorn's answer is on the right track. I converted the image to black/white resulting in a file size of just under 5MB. Then attempted to open and received the error again.

Using the original, I tried all sorts of things and eventually figured out that if I reduced the pixels from 6000×6000 to 5000×5000, I could open the image in Paint.NET (even 24bit color).

Best Answer

It sounds like you're getting an OutOfMemory exception. The .Net OutOfMemory exception is a bit misleading. It's much more common to see this exception when you run out of address space, which is a little different than physical memory. This means things like checking the task manager to see how much memory is used may not help you track the problem.

Instead, the problem is likely the result of a bug in Paint.Net, such that certain parts of the image are placed by the .Net runtime on something called the Large Object Heap. The file is then loaded in such a way that this same set of memory is created and destroyed several times, perhaps such that it gets a little larger each time. The garbage collector doesn't free up or compact the address space from the Large Object Heap very well (even though the physical memory was released or paged), and so suddenly you get an OutOfMemory exception.

The solution is either for Microsoft to change the behavior of the .Net runtime with respect to the LOH, such that it can go in and compact the LOH in certain situations (perhaps on request, or before throwing the OutOfMemory exception), or for the Paint.Net program to fix the way it loads the file such that it correctly grows whatever existing data structure is causing the problem, rather than recreating it over and over.

Related Question