[gdal-dev] New RFC : RFC 19 - Safer memory allocation in GDAL
Frank Warmerdam
warmerdam at pobox.com
Mon Dec 31 11:17:55 EST 2007
Even Rouault wrote:
> Frank,
>
> thank you for the feedback. I've taken your remarks into account and revised
> the RFC accordingly.
>
> A question : while looking at CPLMalloc implementation, I've noticed there's a
> call to CPLVerifyConfiguration. Is there a particular reason for this
> function to be called here / are there situations where the checks fail ... ?
> CPLMalloc also seems to be the unique function to use CPLVerifyConfiguration.
> I'm just curious why it is needed there and not at other places. We could
> imagine that these checks could be done once, early at GDAL or OGR
> initialization, for example in GDALAllRegister or OGRRegisterAll.
> The practical question is : do I need to call CPLVerifyConfiguration in
> CPLSafeMallocX ?
Even,
Due to build configuration mistakes I found under some conditions folks
were building GDAL with the wrong cpl_config.h and ending up with
"endian confusion". The CPLVerifyConfiguration() is intended to be a
quick check to ensure this isn't occuring and that it would be done quite
early in the library setup at runtime.
CPLMalloc() just seemed like a fairly central place to put the check.
There is no need call it from any new malloc functions, though it might
be prudent for the call to be moved/added in some other strategic locations.
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 | President OSGeo, http://osgeo.org
More information about the gdal-dev
mailing list