Subject: [Boost-bugs] [Boost C++ Libraries] #11419: Unexpected memory usage with unorderd_map
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-06-24 17:28:52
#11419: Unexpected memory usage with unorderd_map
---------------------------------------------+--------------------------
Reporter: DarioOliveri <oliveridario89@â¦> | Owner: danieljames
Type: Bugs | Status: new
Milestone: To Be Determined | Component: unordered
Version: Boost Release Branch | Severity: Optimization
Keywords: |
---------------------------------------------+--------------------------
Unordered map does NO rehash when shrinking (erasing specific elements).
When having multiple maps (or even one map) the memory usage become
insanely high (arbitrary) and consequently the program lags because of
insane cache usage
This is not a memory leak, but a undocumented (and unwanted) behaviour.
There are 3 possible ( I figured out ) fixes:
- make rehashing when there are too few elements
- fix documentation to clearly state users must rehash
- add a method with the exact purpose of reducing memory usage
I uploaded the code to reproduce the bug (bug present both in C++11/14 and
in boost) here:
*ttps://github.com/Darelbi/PublicProfileTests/blob/master/BoostMemoryUsage/UnorderedMap.cpp
(beware! running the above code literally freeze also the operative system
due to huge bandiwth usage).
Fixing that problem as soon as possible could automatically increase
performance in a lot of clients code, and that would reduce drastically
memory usage (wich seems the problem with many applications, it is
suprising no one profiled that!)
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/11419> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:18 UTC