php/mapscript queryByRect on raster files
Andrea Marelli
maro.jam at TISCALI.IT
Tue Feb 14 00:25:32 PST 2006
Hi Frank,
thank you very much for your hint,
but I think the RASTER_QUERY_MAX_RESULT, should't be the best solution for
my problem, because i don't need to limit the number of values allowed in a
query, but i need to improve the management of the memory allocation.
I've made some tests, and i've noted that the memory is allocated by the
getShape function. But, in my code, the getShape function is in a for
structure, and in each loop i overwrite all datas (and also i use free and
unset functions!) but it seems that the new $shape object doesn't overwrite
the shape created in the previous loop and it allocates the value in a new
portion of the memory...
How this is possible?
Is there a way to create the object over the previuos, so to use always the
same chunk of memory?
regards,
Andrea
>Andrea,
>
>If you make queries on large areas, a substantial chunk of memory is
>allocated at the point of the query to hold all the results. The maximum
>number of values allowed in a query can be set with the PROCESSING option
>RASTER_QUERY_MAX_RESULT on the layer.
>
>eg.
> PROCESSING "RASTER_QUERY_MAX_RESULT=10000"
>
>The default maximum is one million and I think there are 36 bytes of memory
>allocated per row in the resultset so up to about 36MB. Not such a huge
>amount as a maximum.
>
>I don't know the details of the proper way of freeing shapes, but it
>seems what you are doing is appropriate.
>
>I did a little test, and I don't see any obvious memory leaks in the core
>mapserver raster query support.
>
>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
>Andrea Marelli wrote:
>> Any hint?
>> i will hopefully wait...
>> Thanks!!
>...
>>> i'm implementing queryByRect on raster files using php/mapscript.
>>> The script i've written (see following code) works well, but i have a little
>>> problem when i make queries on large areas...
>>> It seems that the getShape function uses a very large amount of memory on
>>> the server, so i put $shape->free(); but it seems to do nothing..
>>> Any suggestion on how to free shared memory on server?
>
More information about the MapServer-users
mailing list