[gdal-dev] CPLMalloc() and CPLFree() issues....

Frank Warmerdam warmerdam at pobox.com
Thu May 6 15:38:53 EDT 2010


Zermeno, Robert J CIV NAVAIR, 472100D wrote:
> I have been using the standard malloc, but trying to use CPLMalloc() with
> CPLFree().  I have a function that will provide a user with different image
> blocks given specified location.
> 
> So, a function will get repeatedly called to grab the new image data
> content.  On the first round, I can successfully perform CPLMalloc() and
> CPLFree().  However, on the second pass, I get a runtime requested error
> that terminates my program when I do another CPLMalloc().
> 
> Can anyone think why I might be receiving this error message?
> 
> This so far has only happened on RGB images where I have to CPLMalloc()
> three times on the current image.

Robert,

This almost certainly indicates you have corrupted the heap somehow.  I would
check that you aren't double freeing anything and that you are actually
allocating enough memory.  Memory debugging tools like "valgrind" on linux
may help you isolate the problem.

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