Help: Memory Leaks

Frank Warmerdam fwarmerdam at GMAIL.COM
Tue Sep 13 20:22:46 EDT 2005


On 9/13/05, Ned Harding <nharding at extendthereach.com> wrote:
>  
> 
> I'm trying to work with MapServer and getting bunches of memory leaks.  I
> presume I am doing something wrong. 
>   
> In particular there are a bunch of leaks I'm getting in msDrawMap: 
>   
>    Call Stack: 
>     f:\vs70builds\3077\vc\crtbld\crt\src\strdup.c (48):
> _strdup 
>     s:\3rdparty\gis\mapserver\mapoutput.c (464):
> msAllocOutputFormat 
>     s:\3rdparty\gis\mapserver\mapoutput.c (735):
> msCloneOutputFormat 
>     s:\3rdparty\gis\mapserver\mapoutput.c (694):
> msApplyOutputFormat 
>     s:\3rdparty\gis\mapserver\maplegend.c (324):
> msDrawLegend 
>     s:\3rdparty\gis\mapserver\maplegend.c (403):
> msEmbedLegend 
>     s:\3rdparty\gis\mapserver\mapdraw.c (534): msDrawMap 


Ned,

I created a test case with an embedded image (msautotest/misc/legend.map)
and was able to reproduce your leak.  It seems the legend was
rendered to an imageObj.  The gdImage was "stolen" out of this
and pushed into a pixmap symbol to render but the rest of the
imageObj was not cleaned up. 

I also fixed the "can't get rid of the last errorObj in USE_THREAD
mode" problem.  As well I fixed a couple of GDAL/OGR related leaks
though you might not be seeing those. 

The core rendering sequence of mapserver is pretty much leak 
free, but "esoteric" features like legends, less common data 
providers and unusual use modes such might have issues.  I
encourage you to report them when you run into them. 

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



More information about the mapserver-dev mailing list