Commit 5755f841 authored by Ville Pietilä's avatar Ville Pietilä
Browse files

Optimize memory pool insertion.

parent c6ba9545
...@@ -128,7 +128,9 @@ namespace memory { ...@@ -128,7 +128,9 @@ namespace memory {
std::cout << "[ DynamicMemPool ] Creating new pool queue for size " << sizeInBytes << std::endl; std::cout << "[ DynamicMemPool ] Creating new pool queue for size " << sizeInBytes << std::endl;
} }
#endif #endif
memory_pool_[sizeInBytes].push(p); std::queue<void*> q;
q.push(p);
memory_pool_.insert({sizeInBytes, std::move(q)});
memPoolSizeInBytes_ += sizeInBytes; memPoolSizeInBytes_ += sizeInBytes;
} }
#ifdef ENABLE_MEM_POOL_LOGGING #ifdef ENABLE_MEM_POOL_LOGGING
...@@ -230,7 +232,7 @@ namespace memory { ...@@ -230,7 +232,7 @@ namespace memory {
else { else {
std::queue<void*> q; std::queue<void*> q;
q.push(p); q.push(p);
memory_pool_[sizeInBytes] = std::move(q); memory_pool_.insert({sizeInBytes, std::move(q)});
#ifdef ENABLE_MEM_POOL_LOGGING #ifdef ENABLE_MEM_POOL_LOGGING
if (enableLogging_) if (enableLogging_)
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment