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
- From: pcarlini at unitus dot it
- To: Paul Dubuc <pdubuc at cas dot org>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Thu, 6 Nov 2003 10:30:22 +0100
- Subject: Re: Excessive memory usage of large hash_maps
- References: <3FA95D86.4050704@cas.org>
Quoting Paul Dubuc <pdubuc@cas.org>:
> Hash containers are apparently resized on based on a table of prime numbers
>
> (__stl_prime_list) in stl_hashtable.h. As a hash table grows space (number
> of
> buckets) is reallocated based on the next higher number in this list. The
> numbers roughly double with each increment. This isn't noticable in the
> lower
> increments, but can result in a lot of wasted space in the larger ones. Why
>
> should the size continue to double once we get above, say 98317? Couldn't
> smaller increments be inserted here to conserve memory? Better yet provide
a
>
> nice way to override the __stl_next_prime() function?
Hi Paul. Thanks for your suggestion.
FYI, we are in the process (at least I am ;) of adapting the current
__gnu_cxx::hash* code to provide an experimental implementation of Matt
Austern standard proposal for hashed containers, as described in the Library
Technical Report, see:
http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1456.html
Please have a look, this is our reference for the project. I hope to provide a
detailed roadmap in a couple of weeks.
Paolo.