Opened 13 years ago

Closed 13 years ago

#1327 closed defect (fixed)

[raster] ST_AsRaster invalid memory alloc request size

Reported by: robe Owned by: pracine
Priority: medium Milestone: PostGIS 2.0.0
Component: raster Version: master
Keywords: Cc:

Description

I know this is a crazy test. This error is happening on my garden test on my 32-bit windows 7 box with r8242.

I haven't had a chance to isolate the specific part causing the issue.

SELECT ST_AsRaster(foo2.the_geom, rast1.rast, '1BB', 1.5, 1.5, false) 		  
					FROM (
		 	(SELECT ST_SetSRID(ST_SetValue(ST_AddBand(ST_MakeEmptyRaster( 100, 100, (i-1)*100, (i-1)*100, 0.0005, -0.0005, 0*i, 0*i), '16BSI'), i, (i+1),-6000),4326) As rast
		 		FROM generate_series(1,10) As i)
		 ) As rast1 CROSS JOIN ((SELECT ST_Buffer(ST_SetSRID(ST_Point(i,j),4326), j*0.05)  As the_geom
		FROM (SELECT a*1.11111111 FROM generate_series(-10,50,10) As a) As i(i)
			CROSS JOIN generate_series(40,70, 20) As j
			ORDER BY i, i*j, j)) As foo2
					LIMIT 1;

Give me this error:

NOTICE:  Value set for 8BUI band got truncated from 1.500000 to 1
CONTEXT:  PL/pgSQL function "st_asraster" line 26 at RETURN


ERROR:  invalid memory alloc request size 1152096000
CONTEXT:  PL/pgSQL function "st_asraster" line 26 at RETURN

Change History (3)

comment:1 by dustymugs, 13 years ago

I don't know what I can say about this one. The memory alloc error is from GDAL being unable to allocate a little more than 1GB of memory. I'll have to see what the dimensions are on the raster being created.

The rasterization code under-the-hood makes use of the GDAL MEM driver and runs purely in memory. It's possible to have the code use some temp space on the hard drive but that itself has other problems.

comment:2 by dustymugs, 13 years ago

I take back that GDAL having the issue. I've removed some code in the rt_raster_from_gdal_dataset code that attempts to duplicate an entire band at once in r8309. The query causing the error works now. Slow though but that's expected.

comment:3 by dustymugs, 13 years ago

Resolution: fixed
Status: newclosed

I believe your test works now so I'm closing this ticket.

Note: See TracTickets for help on using tickets.