artemp/trac2github — Issue #474: Memory leak in load_map/load_map_from_string
Author: artemp
Created: 2011-10-09 20:36:08+00:00
State: open
Labels: Boost_Python_Binding

It looks like both load_map and load_map_from_string functions have memory leaks. I've attached the script that reproduces the problem (should run fine on any system with ps available). The script itself simply creates a new map, loads XML file and then del's map object in a cycle. Below is the output for 10 iterations:
mishok 11031 0.0 0.6 54536 13440 pts/5 R+ 16:23 0:00 python memleak.py
mishok 11031 86.9 3.5 112948 73736 pts/5 R+ 16:23 0:30 python memleak.py
As you can see memory usage goes from 13MB to almost 74MB. Running valgrind points to some "possible leaks" in libxml2, but I'm not sure if that's relevant.
This script was tested with Mapnik 0.6.0, 0.6.1 and recent checkout of 0.7 branch and the results are the same for all versions.
System: Ubuntu 9.10, Boost version:" 1.38, Python: 2.6, libxml2: 2.7.5.