[Proj] possible memory leak in pj_free ??

Sue Dettling dettling at ucar.edu
Fri Nov 2 18:04:30 EDT 2007


Hi, 
I am using the debian linux (etch) version of proj.
I instantiate a projection object with the following:

if ( (_inputProj = pj_init(6,inputPrjArgs )) == NULL)
  {
    cerr << "ProjInfo::_projectData(): ERROR: Failed to initialize Proj.4 "
	 << "projection object." << endl;
    return(1);
  }

where inputPrjArgs[] = {"proj=laea", "lat_0=38", "lon_0=-98", "x_0=0", "y_0=0", "units=m"}.

It seems to work fine based on output data.

I free the projection with:

if (_inputProj)
    pj_free(_inputProj); 

In stepping through with a debugger I see that the pj_free call is made
however when using valgrind to check for memory leaks I get:

=17191== 48 bytes in 2 blocks are definitely lost in loss record 1 of 1
==17191==    at 0x401D38B: malloc (vg_replace_malloc.c:149)
==17191==    by 0x41ECB2B: pj_malloc (in /usr/lib/libproj.so.0.5.0)
==17191==    by 0x41EA5EF: pj_authset (in /usr/lib/libproj.so.0.5.0)
==17191==    by 0x41CD4A9: pj_laea (in /usr/lib/libproj.so.0.5.0)
==17191==    by 0x41EC577: pj_init (in /usr/lib/libproj.so.0.5.0)
==17191==    by 0x805C505: ProjInfo::_initializeProj4() (ProjInfo.cc:453)
==17191==    by 0x805E51F: ProjInfo::init() (ProjInfo.cc:84)
==17191==    by 0x8052449: NcfReader::_getGriddedData() (NcfReader.cc:683)
==17191==    by 0x8052FD0: NcfReader::readFile() (NcfReader.cc:169)
==17191==    by 0x80504B5: NetCDF2Mdv::_processData(char*) (NetCDF2Mdv.cc:211)
==17191==    by 0x80509D9: NetCDF2Mdv::Run() (NetCDF2Mdv.cc:173)
==17191==    by 0x804F51D: main (Main.cc:67)


Are there any known or possible leaks with pj_free ?

Thanks for any advice,
S.



More information about the Proj mailing list