[Proj] EXCEPTION_ACCESS_VIOLATION (0xc0000005) after many successful calls to pj_init_plus
Aaron Friesen
aaron at cartopac.com
Wed Oct 27 16:20:46 PDT 2010
Everyone,
I have an application that runs as a web service. It
runs for a while, then any call to pj_init_plus with
the same string that has been successfully running
up to that point eventually results in an access
violation during the pj_init_plus call.
Restarting the service clears up the problem for a
while, but once it hits, proj seems to be in a
problem state.
I believe I'm running 4.6.1.
Are there any known problems like this?
Does anyone see a problem with how I am calling proj?
My sanitized code looks like (VS2005, c++):
HRESULT Xform(int numXY, double* x, double* y, int numZ, double* z, char* src, char* dst)
{
if (numXY <= 0)
return S_FALSE;
if (!x || !y || (numZ > 0 && !z))
return E_INVALIDARG;
HRESULT hr = S_OK;
projPJ srcPJ = NULL;
projPJ dstPJ = NULL;
try
{
if (numZ == 0)
z = NULL;
if (!xformSpec.proj4CfsDefn || wcslen(xformSpec.proj4CfsDefn) == 0)
throw E_INVALIDARG;
srcPJ = pj_init_plus((char*)src);
if (!srcPJ)
throw E_PROJ_BAD_SRC_DEFN;
dstPJ = pj_init_plus((char*)dst);
if (!dstPJ)
throw E_PROJ_BAD_DST_DEFN;
int projResult = pj_transform(srcPJ, dstPJ, numXY, 1, x, y, z);
if (projResult != 0)
throw E_PROJ_FAILED;
}
catch(HRESULT thrown) { hr = thrown; }
catch(...) { hr = E_UNEXPECTED; }
if (srcPJ)
pj_free(srcPJ);
if (dstPJ)
pj_free(dstPJ);
return (FAILED(hr) ? hr : S_OK);
}
Thanks,
Aaron
More information about the Proj
mailing list