MapServer 4.10.1 Memory Leak still exists

Umberto Nicoletti umberto.nicoletti at GMAIL.COM
Sun Apr 22 05:22:19 EDT 2007


While working on another thing I have found the following leak in
freeClass (mapfile.c, around line 2103) where not all styles are
always freed:

Original code:
  for(i=0;i<class->numstyles;i++) /* LEAK: we should free MS_MAXSTYLES!!! */

Should be:
  for(i=0;i<MS_MAXSTYLES;i++) { /* each style     */

This would leak 180bytes (sizeof(styleObj)=180) for each unused style
of each class of each layer. Mapserver as it is now allocates 200
layers with 250 classes each and each class has 5 styles. Supposing
that one uses only one style for each class the total leak is, for
every new mapObj:

(200*250*4) * 180 = 35K

Please note that is quite likely to represent the lower bound as not
every one will have 250 classes for each layer! At this point You
should be able to estimate if this is more or less the size of the
leak you are experiencing.
In example a map with 30 layers and one class for each layer will leak:

( (30*1*4) + (30*249*5) + (170*250*5) ) * 180 ~ 44Kb

This issue has been fixed in CVS recently, now it is only a matter of
getting it into ms4w. For that you should ask in the ms4w mailing
lists.

Regards,
Umberto


On 4/20/07, David Martin <david at itbeyond.com.au> wrote:
> Umberto,
>
> The data type is shape. The number of active layers depends on zoom level
> however in the map file there is a total of 39 layer definitions, with between
> 10 and 30 active at any one time. The queries are run only in one layer.
>
> I have done some more work on the system and improved the operation by
> caching commonly used images. You can have a look at the application live if
> you wish - it is an infant however running live (I note it is crashed at the
> moment so must recycle app pool - which is in the process of being done). To
> see it running visit http://www.exploroz.com/Places/Find/CaravanPark.asp?
> ms=1 - The initial map is cached so use mouse and draw a box to run a query -
>  you will either see the crash message or a refined result set.
>
> The application is running on a Win 2003 server so no access to Linux tools. I
> have been using the same .map file with the CGI interface for a few years and
> never had problem at all.
> I note that I can run the cgi mapserver process after the system has reported
> the .net memory allocation error. A sample of the CGI interface using the
> same .map file is as follows http://www.exploroz.com/cgi-
> bin/MapServer/MapServ.exe?mode=browse&map=e:\\inetpub\\vs126169
> \\iMapPlot\\map\\ExplorOzBase.map&map_PointRef_feature=new&map_PointRef
> _feature_points=153.5136%20-27.4211&map_PointRef_feature_text=Adder%
> 20Rock&mapext=152.7636%20-28.1711%20154.2636%20-
> 26.6711&themode=zoomin&MapLabel=Show%20Me%20-%20Adder%20Rock%
> 20-27.4211%20153.5136
>
> Any help would be appreciated.
>
> Regards
> David Martin
>



More information about the mapserver-users mailing list