[gdal-dev] Thread safety of GDAL projection machinery?
Charles Karney
ckarney at sarnoff.com
Wed May 27 14:41:57 EDT 2009
I have a multi-threaded application with reads the geodata out of many
files using GDAL.
For each image, it calls
GDALCreateGenImgProjTransformer(// Source
dataset,GDALGetProjectionRef(dataset),
// Dest (NULL means dest is geo)
NULL, WGS84.c_str(),
// Don't use GCPs
0, 0, 0 );
and I then compute the lat/long of the 4 image corners.
I call
GDALAllRegister();
before entering the multi-threaded portion of the code.
With files that require that pcs.csv be read, I get the following error
messages
ERROR 3: Read of file c:/Program Files (x86)/FWTools2.2.8/data/pcs.csv failed.
ERROR 3: Read of file c:/Program Files (x86)/FWTools2.2.8/data/pcs.csv failed.
ERROR 2: CPLRealloc(): Out of memory allocating 1956 bytes.
ERROR 3: Read of file c:/Program Files (x86)/FWTools2.2.8/data/pcs.csv failed.
ERROR 3: Read of file c:/Program Files (x86)/FWTools2.2.8/data/pcs.csv failed.
ERROR 3: Read of file c:/Program Files (x86)/FWTools2.2.8/data/pcs.csv failed.
ERROR 3: Read of file c:/Program Files (x86)/FWTools2.2.8/data/pcs.csv failed.
ERROR 3: Read of file c:/Program Files (x86)/FWTools2.2.8/data/datum.csv failed.
ERROR 3: Read of file c:/Program Files (x86)/FWTools2.2.8/data/ellipsoid.csv failed.
ERROR 2: CPLRealloc(): Out of memory allocating 409 bytes.
ERROR 1: No PROJ.4 translation for source SRS, coordinate
transformation initialization has failed.
This is with 6 threads. The error messages change from invocation to
invocation as is typical with multi-threading bugs.
If I change the code so that one a single thread is handling the GDAL
stuff, everything works OK.
* Is this "supposed" to work?
* Do I need to do something outside the threaded portion of the code to
initialize the projection machinery?
* If it's known not to work, what GDAL calls do I need to protect with
locks?
Thanks for the help!
--
Charles Karney <ckarney at sarnoff.com>
Sarnoff Corporation, Princeton, NJ 08543-5300
Tel: +1 609 734 2312
Fax: +1 609 734 2662
More information about the gdal-dev
mailing list