[Proj] Memory leaks using proj.4 DLL

michael.hovenbitzer at bkg.bund.de michael.hovenbitzer at bkg.bund.de
Wed Jan 28 07:24:15 EST 2009


first of all I would like to point out, that I use the proj.dll
in my own MFC-VisualC-Program. The call of the functions pj_init_plus()
and pj_transform() result in memory leaks:

static const char *pgk2 = "+proj=tmerc +lat_0=0 +lon_0=6 +k=1.000000
+x_0=2500000 +y_0=0 +ellps=bessel +nadgrids=./BETA2007.gsb +units=m +no defs" ;
quellsys = pj_init_plus(pgk2) ;
static const char *put32 = "+proj=utm +ellps=GRS80 +datum=WGS84 +zone=32" ;
zielsys = pj_init_plus(put32) ;
pj_transform (quellsys, zielsys, 1, 0, &r, &h, &z) ;

The following log of the debug mode appear :
Detected memory leaks!
Dumping objects ->
{154} normal block at 0x00463BA0, 15 bytes long.
 Data: <./BETA2007.gsb > 2E 2F 42 45 54 41 32 30 30 37 2E 67 73 62 00 
{153} .....

The DLL is working, but in most cases the coordinates
are wrong. 
I would be very happy, if the problem could be solved.

Best regards


-----Ursprüngliche Nachricht-----
Von: proj-bounces at lists.maptools.org [mailto:proj-bounces at lists.maptools.org] Im Auftrag von Frank Warmerdam
Gesendet: Dienstag, 27. Januar 2009 16:52
An: PROJ.4 and general Projections Discussions
Betreff: Re: [Proj] Memory leaks using proj.4 DLL

michael.hovenbitzer at bkg.bund.de wrote:
> Hello List,
> I would like to use Proj.4 in a MFC-VisualC-Program (VC++6)
> to transform coordinates with the NTv2-method.
> Using the newest source of proj4.6.1 I build the proj.dll
> and so on. The compilation and linking of my software
> went quite well (with only a few problems solved in your list).
> But when I start my software I got memory leaks !
> Testing the DLL with only one button I could discover that
> the DLL is working correct (the transfromed point had the
> right coordinates). Using all GUI-Features the transformed
> coordinates are wrong, because of memory leaks (the name
> of the shift file is seemingly overwritten).
> Maybe someone has had a similar problem and can help me
> solving my problem.


I tried the following command with one test point under valgrind
and it did not seem to indicate any memory leaks:

   cs2cs +proj=latlong +datum=NAD27 +to +proj=latlong +datum=NAD83

This did load and use the conus grid shift file.  I also tried a
point using the New Zealand NTv2 grid shift file.  Also no report of

Could you be more specific about how you have determined there is a leak?

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

Proj mailing list
Proj at lists.maptools.org

More information about the Proj mailing list