Perl mapscript memory leak?

Stephen Woodbridge woodbri at SWOODBRIDGE.COM
Wed Jun 28 11:16:51 EDT 2006

Hi Steve et al,

I ported the ka-map precache2.php to perl and it seems to have a memory 
leak. I'm not sure what is leaking but when I running it, like on the 
1000000, and watch top, you can see the memory grow and it eventually 
fails to on $oMap->draw() command. If I rerun the script and skip the 
already generated tiles, it gets to that same image and works fine then 
memory grows as it writes more tiles and dies again.

Processing scale=1000000, cellSize=0.00317478168804209
   geo dimensions: -160, 15 : -60, 75
   pix dimensions: -50397.16608, 4724.73432 : -18898.93728, 23623.6716
   meta dimensions: -51200, -24320 : -17920, -3840
   meta tiles: 26 x 16 = 416 meta tiles and 10400 tiles
     Group: __base__
Can't call method "save" on an undefined value at ./ line 352.

There is a chance that this is related, but I'm guessing it is 
more likely a problem with perl/mapscript. Neither nor mapscript 
have explicit image destroy methods. These are all in narrow scoped 
loops and I have try to explicitly undef the variables but that doesn't 

I'm running a version of mapserver cvs from a few weeks ago. I can 
upgrade to the current cvs, but was reluctant to in the middle of SteveL 
doing GEOS commits yesterday.

This would be a good stress test of the API and I'm willing to provide 
the script.

Any thoughts?


More information about the mapserver-dev mailing list