Radim Blazek wrote:
Hi,
does the GDALClose function called for MEM driver call free() on the
memory passed to the driver as DATAPOINTER param? If so, how to avoid
it?

Radim,

Internally the driver tries to keep track of whether it owns the
referenced memory or not.  It looks like if you use a DATAPOINTER
parameter with either MEMDataset::Open() or ::AddBand() it assumes
the caller retains ownership of the memory.  If you call AddBand()
without a DATAPOINTER it will allocate it internally and take
responsibility for destroying it.

If you call the MEMRasterBand() constructor directly yourself (not
possible through the generic GDAL API) then you can pass in the flag
indicating whether the memory is owned or not.

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

_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to