[Tile-serving] [osm2pgsql] Remove the global text-tree string storage and make keyval a real class (#240)
Sarah Hoffmann
notifications at github.com
Fri Dec 26 22:37:28 UTC 2014
The binary tree string storage for tag keys and values in text-tree.cpp is not thread-safe. The current code works around the issue by creating a new tree for each new tag list. That is not much more efficient than simply copying the strings around and has some bugs that cause memory leakage.
This pull request gets completely rid of the binary tree and replaces it with std::string for key and value that properly clean up after themselves. It also replaces the static functions in the keyval class by proper member functions, making the code a tiny bit more readable.
This gets rid of most of the memory leaks (see #228) for me. The remaining leaks that valgrind shows are small one time allocations. I haven't tested the impact of this pull request on performance yet.
You can merge this Pull Request by running:
git pull https://github.com/lonvia/osm2pgsql fix-keyvals
Or you can view, comment on it, or merge it online at:
https://github.com/openstreetmap/osm2pgsql/pull/240
-- Commit Summary --
* replace keyval::initList with proper C++ constructor use
* make sure keyval items always use their own tree_ctx
* remove text-tree and make keyval a real C++ class
-- File Changes --
M Makefile.am (2)
M geometry-processor.cpp (4)
M keyvals.cpp (240)
M keyvals.hpp (70)
M middle-pgsql.cpp (39)
M middle-ram.cpp (20)
M osm2pgsql.cpp (1)
M output-gazetteer.cpp (590)
M output-gazetteer.hpp (2)
M output-multi.cpp (6)
M output-pgsql.cpp (18)
M parse-o5m.cpp (16)
M parse-pbf.cpp (34)
M parse-xml2.cpp (20)
M table.cpp (21)
M tagtransform.cpp (364)
M tests/middle-tests.cpp (13)
M tests/test-output-multi-line.cpp (1)
M tests/test-output-multi-point-multi-table.cpp (1)
M tests/test-output-multi-point.cpp (1)
M tests/test-output-multi-polygon.cpp (1)
M tests/test-output-pgsql.cpp (1)
M tests/test-parse-xml2.cpp (1)
D text-tree.cpp (101)
D text-tree.hpp (21)
-- Patch Links --
https://github.com/openstreetmap/osm2pgsql/pull/240.patch
https://github.com/openstreetmap/osm2pgsql/pull/240.diff
---
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/pull/240
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20141226/9fb09af3/attachment.html>
More information about the Tile-serving
mailing list