This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Excessive memory usage of large hash_maps
Quoting Paul Dubuc <pdubuc@cas.org>:
> If patching it is the best approach, would adding more prime numbers
> to the table be a good solution?
> We have a cases when large hash tables temporarily increase size over a
> given threshold, their size doubles and the process uses excessive memory.
> It also appears that when one hash table is copied to another the large
> capacity is duplicated even though the number of elements in the source
> container may have decreased significantly below the high water mark.
Hi again, Paul.
The issues you are bringing to the fore are real and in fact, if you look
under Sec. E of the document I mentioned before, you will notice that a
specific novelty of Matt's proposal is the "load factor control" which
replaces the previous "resize" way the user had to control the size of
the hashtable.
Note, in particular (to partially answer your second point), that, in
Matt's proposal, both the copy contructor and the copy assignment operator
don't copy the load factor but only the maximum load factor thus making
possible for a conforming implementation to obviate to the problem.
All of this will be definitely dealt with in the next few weeks as part of
the effort that I mentioned before. I hope you will continue to provide your
important feedback then.
Paolo.
P.S. In the process will be obviously also fixed the inhability of the current
hashed containiers to work with long long types.