Help: Memory Leaks

Ned Harding nharding at EXTENDTHEREACH.COM
Tue Sep 13 17:32:56 EDT 2005


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
    s:\wrigley\plugins\wrigleyspatialpluginsengine\mapserver.cpp (423):
SRC::Wrigley::MapServerInterface::MakeMap

The code calling msDrawMap looks like:

				imageObj *pImage = msDrawMap(pMap);
				if (!pImage)
					throw
SRC::Error(msGetErrorObj()->message);
				unsigned nStatus = msSaveImage(pMap, pImage,
pFile);
				msFreeImage(pImage);

Also, I'm getting leaks from msCleanup()!
    s:\3rdparty\gis\mapserver\maperror.c (172): msGetErrorObj
    s:\3rdparty\gis\mapserver\maperror.c (256): msResetErrorList
    s:\3rdparty\gis\mapserver\maputil.c (1307): msCleanup
    s:\wrigley\plugins\wrigleyspatialpluginsengine\mapserver.cpp (443):
SRC::Wrigley::MapServerInterface::MakeMap

It seams that msCleanup creates an error object even if there wasn't
previously one and it doesn't clean it up.

What am I doing wrong?  There about about 50 more leaks than this and this
is pruducing a single map.  I'm calling msFreeMap and msCleanup... Is there
something different I should be calling?
 
Ned Harding
Chief Technology Officer
SRC - Extending the Reach of Micromarketing
3825 Iris Ave Suite 150
Boulder, CO 80303
(303) 440-8896 x104

http://www.extendthereach.com <http://www.extendthereach.com/> 

Technology in Action:

http://www.DemographicsNow.com <http://www.demographicsnow.com/> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20050913/a9a577f3/attachment.html


More information about the mapserver-dev mailing list