This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Excessive memory usage of large hash_maps


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]