Hi!
I have written code using STL hash_map in c++ and am running into memory issues. I have two kinds of hash_maps:
A <int,int> which stores ~5million key-value pairs, and needs to be accessed often to store in memory, its not updated during the program.
B <int,hash_map<int,float>> which is also ~5m key-value pairs, but I can read this in parts from the disk. The inner hash_map has about 20 elements.
In my program, I read in A and B1(first 100K key-values), I perform the required computation, and say B1.clear(), and read the next set of 100k elements.
1) The program exits with an std::bad_alloc error. How can I fix this?
2) What hash_fns would be good for this large data?
3) It seems that clear does not free the memory. What can I do? When I say B1.clear(), will it free the inner hash_map also?
4) How can I find out what is using up the memory?
I am a novice to stl programing, any help would be appreciated.
Thanks!