Skip to content

Commit f5bdc37

Browse files
Fix memory leak in QuadTreeIndex
Thread local instance of MemoryPoolAllocator kept memory allocated for previous documents and grew during runtime. Signed-off-by: Michal Zimonczyk <ext-michal.zimonczyk@here.com>
1 parent 3cfddaa commit f5bdc37

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

olp-cpp-sdk-dataservice-read/src/repositories/QuadTreeIndex.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,7 @@ QuadTreeIndex::QuadTreeIndex(const cache::KeyValueCache::ValueTypePtr& data) {
101101

102102
QuadTreeIndex::QuadTreeIndex(const geo::TileKey& root, int depth,
103103
std::stringstream& json_stream) {
104-
thread_local rapidjson::CrtAllocator crt_allocator;
105-
thread_local rapidjson::MemoryPoolAllocator<> pool_allocator;
106-
rapidjson::Document doc(&pool_allocator, 4096, &crt_allocator);
104+
rapidjson::Document doc;
107105

108106
rapidjson::IStreamWrapper stream(json_stream);
109107
doc.ParseStream(stream);

0 commit comments

Comments
 (0)