Out of Memory Exception when loading TIFF files

Jul 13, 2012 at 1:04 PM

I'm having quite a big problem with Dotspatial that I can't seem to find a full answer to.

I've seen many people discuss LARGE file sizes not being able to load into dot spatial but the TIFF file sizes that I am trying to load are ranging from 600kb to 3mb. Can anyone explain why it can only load 6 files?

The 6 files only add up to a total of 9mb but when I try to add another file it just throws the Out Of Memory exception and I can't see why.

Any help here would be very grateful as we are hoping to use dot spatial as an alternative to mapping software we already use and feel that the speed that dot spatial works with rendering is just fantastic and doesn't require us to do that much more work to get it working to the standard of our previous software.

Thanks in advance!

Jul 13, 2012 at 6:53 PM

In a normal 32 bit windows app, the process only has 2GB of addressable memory. This is irrelevant to the amount of physical memory that is available.

So 2GB available but 1.5 is the max you can allocate. The key is that your code is not the only code running in the process. The other .5 GB is probably the CLR plus fragmentation in the process. See http://stackoverflow.com/questions/505882/out-of-memory-exception

In the current DotSpatial, fragmentation usually causes trouble very quickly, because arrays (contiguous memory spaces) are used. Also, images are decompressed as they are loaded so they take much more space in memory than on disk.

See also http://msdn.microsoft.com/en-us/magazine/cc163528.aspx

If you would like to use a profiler, you might be able to verify whether this is the case for your files.

I would recommend installing the Gdal extension, which I would expect to successfully open your files.