[Mapserver-dev] [PATCH] mapraster.c - fixing memory leaks
Sean Gillies
sgillies at frii.com
Tue Jun 15 22:00:44 EDT 2004
As long as the GOTO jump remains inside a function I'm fine with them.
If we start using GOTO to have alternate ways for functions to return,
it will eventually break our scripting interface.
Sean
On Jun 15, 2004, at 5:03 PM, Steve Lime wrote:
> Patch aside, what do folks think about using goto's? They seem a great
> help with things like clean-up. However there's not one in the code
> presently so I was wondering if there's a bias...
>
> Steve
>
> Stephen Lime
> Data & Applications Manager
>
> Minnesota DNR
> 500 Lafayette Road
> St. Paul, MN 55155
> 651-297-2937
>>>> "Mladen Turk" <mturk at apache.org> 06/02/04 11:18 AM >>>
>
> Hi all,
>
> Mapraster has a memory leak bug not freeing allocated temporary layer.
> The quickest solution would be to just add the tlptemp variable, but
> I've
> added standard 'cleanup:' label for function exiting.
>
> Having something like mpatrol gives:
>
> Total unfreed bytes: 92899
> Peak memory usage: 1699139
> Largest allocation: 235750
> Smallest allocation: 1
> Total Allocations: 513
> Total Frees: 505
> Peak Allocations: 385
>
>
> The patch for mapraster.c gives:
>
> Total unfreed bytes: 14
> Peak memory usage: 1699139
> Largest allocation: 235750
> Smallest allocation: 1
> Total Allocations: 513
> Total Frees: 512
> Peak Allocations: 385
>
> So we've save cca 92K of memory on each request.
>
> Here is the patch:
> (I can file a bug report if needed)
>
> There is still 14 bytes left hanging but the reason is in the
> getString()
> from mapfile.c used somewhere :). I'll try to hunt that down.
>
> MT.
>
> _______________________________________________
> Mapserver-dev mailing list
> Mapserver-dev at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-dev
>
More information about the mapserver-dev
mailing list