[gdal-dev] gdalwarp: ERROR 2: Out of memory allocating {number} byte destination buffer.

Frank Warmerdam warmerdam at pobox.com
Wed Jun 8 15:46:59 EDT 2011


On 11-06-08 03:05 PM, Matt Wilkie wrote:
> Hi Folks,
>
> Can anyone tell me what this error means and how to work around it?
>
> Win7 x64 command shell
> osgeo4w gdal 1.8
> 13gb ram (~4.7gb free according to Process Explorer)
> 121gb free on the drive (mapped to network)
> 20gb free on drive pointed to by %TEMP%
>
> There are 26 input files whose size ranges from 110mb to 260mb, totalling
> 5.5gb(ftp://ftp.geomaticsyukon.ca/DEMs/CDED_50k/)
>
> If I up GDAL_CACHEMAX and -wm to higher value, like 2048, I get the error on
> every single input file instead of just some (I'm still waiting for the results
> of not using those options at all).
>
> -----
> *gdalinfo --version
> *GDAL 1.8.0, released 2011/01/12*
>
> set .gdopt=*--config GDAL_CACHEMAX 500 -wm 500 --config bigtiff if_safer -multi
...

> Processing input file ..\dem_115F.tif.
> Using internal nodata values (eg. -3.40282e+038) for image ..\dem_115F.tif.
> 0...10...20...30...40...50ERROR 2: Out of memory allocating 365425784 byte
> destination buffer.

Matt,

Despite being on Win7 x64 OSGeo4W is still all 32bit executables and
they operate in a 32bit process space.  My understanding is that Win32
processes are frequently subject to memory fragmentation problems and
so even in a process with - in theory - 2GB of heap RAM space available
it is still often difficult to allocate large blocks of memory.   In this
case with -wm 500 set the main warp buffers can be quite large (364MB
for one in your case) and it seems it has failed to allocate the buffer.

I imagine you will just have to use more modest buffers or else get a 64bit
executable for gdalwarp.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list