<!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>RE: [UMN_MAPSERVER-DEV] Help: Memory Leaks</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=2>Thank you Frank for looking in to that... I guess the short answer is that I probably wasn't doing anything wrong. When we have some spare cycles Jani or I will chase some of the other leaks down...</FONT></P>
<P><FONT SIZE=2>On a related note:</FONT>
</P>
<P><FONT SIZE=2>I know most people on this list are on Linux, but for finding memory leaks on Windows I have found a really handy free tool that is super easy to use:</FONT></P>
<P><FONT SIZE=2><A HREF="http://www.codeproject.com/tools/visualleakdetector.asp" TARGET="_blank">http://www.codeproject.com/tools/visualleakdetector.asp</A></FONT>
</P>
<P><FONT SIZE=2>Ned.</FONT>
</P>
<P><FONT SIZE=2>-----Original Message-----</FONT>
<BR><FONT SIZE=2>From: Frank Warmerdam [<A HREF="mailto:fwarmerdam@gmail.com">mailto:fwarmerdam@gmail.com</A>] </FONT>
<BR><FONT SIZE=2>Sent: Tuesday, September 13, 2005 5:23 PM</FONT>
<BR><FONT SIZE=2>To: Ned Harding</FONT>
<BR><FONT SIZE=2>Cc: MAPSERVER-DEV@lists.umn.edu</FONT>
<BR><FONT SIZE=2>Subject: Re: [UMN_MAPSERVER-DEV] Help: Memory Leaks</FONT>
</P>
<P><FONT SIZE=2>On 9/13/05, Ned Harding <nharding@extendthereach.com> wrote:</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> I'm trying to work with MapServer and getting bunches of memory leaks. </FONT>
<BR><FONT SIZE=2>> 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):</FONT>
<BR><FONT SIZE=2>> _strdup </FONT>
<BR><FONT SIZE=2>> s:\3rdparty\gis\mapserver\mapoutput.c (464):</FONT>
<BR><FONT SIZE=2>> msAllocOutputFormat </FONT>
<BR><FONT SIZE=2>> s:\3rdparty\gis\mapserver\mapoutput.c (735):</FONT>
<BR><FONT SIZE=2>> msCloneOutputFormat </FONT>
<BR><FONT SIZE=2>> s:\3rdparty\gis\mapserver\mapoutput.c (694):</FONT>
<BR><FONT SIZE=2>> msApplyOutputFormat </FONT>
<BR><FONT SIZE=2>> s:\3rdparty\gis\mapserver\maplegend.c (324):</FONT>
<BR><FONT SIZE=2>> msDrawLegend </FONT>
<BR><FONT SIZE=2>> s:\3rdparty\gis\mapserver\maplegend.c (403):</FONT>
<BR><FONT SIZE=2>> msEmbedLegend </FONT>
<BR><FONT SIZE=2>> s:\3rdparty\gis\mapserver\mapdraw.c (534): msDrawMap</FONT>
</P>
<BR>
<P><FONT SIZE=2>Ned,</FONT>
</P>
<P><FONT SIZE=2>I created a test case with an embedded image (msautotest/misc/legend.map)</FONT>
<BR><FONT SIZE=2>and was able to reproduce your leak. It seems the legend was</FONT>
<BR><FONT SIZE=2>rendered to an imageObj. The gdImage was "stolen" out of this</FONT>
<BR><FONT SIZE=2>and pushed into a pixmap symbol to render but the rest of the</FONT>
<BR><FONT SIZE=2>imageObj was not cleaned up. </FONT>
</P>
<P><FONT SIZE=2>I also fixed the "can't get rid of the last errorObj in USE_THREAD</FONT>
<BR><FONT SIZE=2>mode" problem. As well I fixed a couple of GDAL/OGR related leaks</FONT>
<BR><FONT SIZE=2>though you might not be seeing those. </FONT>
</P>
<P><FONT SIZE=2>The core rendering sequence of mapserver is pretty much leak </FONT>
<BR><FONT SIZE=2>free, but "esoteric" features like legends, less common data </FONT>
<BR><FONT SIZE=2>providers and unusual use modes such might have issues. I</FONT>
<BR><FONT SIZE=2>encourage you to report them when you run into them. </FONT>
</P>
<P><FONT SIZE=2>Best regards,</FONT>
<BR><FONT SIZE=2>-- </FONT>
<BR><FONT SIZE=2>---------------------------------------+--------------------------------------</FONT>
<BR><FONT SIZE=2>I set the clouds in motion - turn up | Frank Warmerdam, warmerdam@pobox.com</FONT>
<BR><FONT SIZE=2>light and sound - activate the windows | <A HREF="http://pobox.com/~warmerdam" TARGET="_blank">http://pobox.com/~warmerdam</A></FONT>
<BR><FONT SIZE=2>and watch the world go round - Rush | Geospatial Programmer for Rent</FONT>
</P>
</BODY>
</HTML>