<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2658.24">
<TITLE>Help: Memory Leaks</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=2>I'm trying to work with MapServer and getting bunches of memory leaks. I presume I am doing something wrong.</FONT>
<BR><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2>In particular there are a bunch of leaks I'm getting in msDrawMap:</FONT>
<BR><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2> Call Stack:</FONT>
<BR><FONT SIZE=2> f:\vs70builds\3077\vc\crtbld\crt\src\strdup.c (48): _strdup</FONT>
<BR><FONT SIZE=2> s:\3rdparty\gis\mapserver\mapoutput.c (464): msAllocOutputFormat</FONT>
<BR><FONT SIZE=2> s:\3rdparty\gis\mapserver\mapoutput.c (735): msCloneOutputFormat</FONT>
<BR><FONT SIZE=2> s:\3rdparty\gis\mapserver\mapoutput.c (694): msApplyOutputFormat</FONT>
<BR><FONT SIZE=2> s:\3rdparty\gis\mapserver\maplegend.c (324): msDrawLegend</FONT>
<BR><FONT SIZE=2> s:\3rdparty\gis\mapserver\maplegend.c (403): msEmbedLegend</FONT>
<BR><FONT SIZE=2> s:\3rdparty\gis\mapserver\mapdraw.c (534): msDrawMap</FONT>
<BR><FONT SIZE=2> s:\wrigley\plugins\wrigleyspatialpluginsengine\mapserver.cpp (423): SRC::Wrigley::MapServerInterface::MakeMap</FONT>
</P>
<P><FONT SIZE=2>The code calling msDrawMap looks like:</FONT>
</P>
<P> <FONT SIZE=2>imageObj *pImage = msDrawMap(pMap);</FONT>
<BR> <FONT SIZE=2>if (!pImage)</FONT>
<BR> <FONT SIZE=2>throw SRC::Error(msGetErrorObj()->message);</FONT>
<BR> <FONT SIZE=2>unsigned nStatus = msSaveImage(pMap, pImage, pFile);</FONT>
<BR> <FONT SIZE=2>msFreeImage(pImage);</FONT>
</P>
<P><FONT SIZE=2>Also, I'm getting leaks from msCleanup()!</FONT>
<BR><FONT SIZE=2> s:\3rdparty\gis\mapserver\maperror.c (172): msGetErrorObj</FONT>
<BR><FONT SIZE=2> s:\3rdparty\gis\mapserver\maperror.c (256): msResetErrorList</FONT>
<BR><FONT SIZE=2> s:\3rdparty\gis\mapserver\maputil.c (1307): msCleanup</FONT>
<BR><FONT SIZE=2> s:\wrigley\plugins\wrigleyspatialpluginsengine\mapserver.cpp (443): SRC::Wrigley::MapServerInterface::MakeMap</FONT>
</P>
<P><FONT SIZE=2>It seams that msCleanup creates an error object even if there wasn't previously one and it doesn't clean it up.</FONT>
</P>
<P><FONT SIZE=2>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?</FONT></P>
<P><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2>Ned Harding</FONT>
<BR><FONT SIZE=2>Chief Technology Officer</FONT>
<BR><FONT SIZE=2>SRC - Extending the Reach of Micromarketing</FONT>
<BR><FONT SIZE=2>3825 Iris Ave Suite 150</FONT>
<BR><FONT SIZE=2>Boulder, CO 80303</FONT>
<BR><FONT SIZE=2>(303) 440-8896 x104</FONT>
</P>
<P><FONT SIZE=2><A HREF="http://www.extendthereach.com" TARGET="_blank">http://www.extendthereach.com</A> <<A HREF="http://www.extendthereach.com/" TARGET="_blank">http://www.extendthereach.com/</A>> </FONT>
</P>
<P><FONT SIZE=2>Technology in Action:</FONT>
</P>
<P><FONT SIZE=2><A HREF="http://www.DemographicsNow.com" TARGET="_blank">http://www.DemographicsNow.com</A> <<A HREF="http://www.demographicsnow.com/" TARGET="_blank">http://www.demographicsnow.com/</A>> </FONT>
</P>
</BODY>
</HTML>