[Proj] Memory leaks using proj.4 DLL

michael.hovenbitzer at bkg.bund.de michael.hovenbitzer at bkg.bund.de
Mon Feb 9 05:26:44 EST 2009


Frank,

thank you for your help !
The missing call of the function pj_deallocate_grids() 
was the reason for the memory leaks.

Best regards

Michael  

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

michael.hovenbitzer at bkg.bund.de wrote:
> Frank,
> 
> 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} .....

Michael,

Are you calling pj_free() on all definitions created with pj_init_plus()?
Are you calling pj_deallocate_grids() before program termination?

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

I'm not familiar with BETA2007.gsb, nor your coordinate systems.  Generally
it does not make sense to specify datum=WGS84 with an ellipse other than WGS84.

Perhaps you could specify what values you pass in, what values you expect,
what values you get, what your coordinate system definitions are,and why you
think they are appropriate (ie. references to the coordinate systems you are
trying to represent).

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
http://lists.maptools.org/mailman/listinfo/proj


More information about the Proj mailing list