This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Excessive memory usage of large hash_maps
- From: Paul Dubuc <pdubuc at cas dot org>
- To: libstdc++ at gcc dot gnu dot org
- Date: Wed, 05 Nov 2003 15:28:54 -0500
- Subject: Excessive memory usage of large hash_maps
- Organization: Chemical Abstracts Service (CAS)
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?
--
Paul M. Dubuc