-
Notifications
You must be signed in to change notification settings - Fork 826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leak in load_map/load_map_from_string #473
Comments
[mishok13] Sometimes I hate myself for forgetting about existence of preview button. Here's the version with correct formatting: 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 Below is the output for 10 iterations: {{{ 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. |
[mishok13] Uhm, it looks like libxml2 (or mapnik?) doesn't release memory after parsing the XML file. I guess that's related to the fact that |
[mishok13] Nope, calling xmlFreeDoc doesn't help. Calling malloc_trim(0) in libxml2_loader destructor didn't help either. |
[springmeyer] mishok13, I see you cc'ed yourself - are you not getting emails as the 'reporter'? Perhaps your email is not filled out in the trac prefs? http://trac.mapnik.org/prefs |
[springmeyer] hmm, calling xmlFreeDoc does work for me. I can replicate, and fix, on Mac 10.5 with: {{{ Index: src/libxml2_loader.cpp--- src/libxml2_loader.cpp (revision 1505)
Here is the output of the testing script before and after: Current trunk on osx 10.5: {{{ With xmlFreeDoc() |
[springmeyer] so, this should be fixed in trunk in r1507 and the 0.7 series branch in r1506. Feel free to re-open if this does not fix for you. |
[mishok13] Damn it, I knew something went wrong with cc. :) |
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.
The text was updated successfully, but these errors were encountered: