473,320 Members | 1,825 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

std::hash_map consumes excessive memory?

I have simple hash_map<int, int>. When I insert 1000 entries my memory
grows by about 2 MB (or almost 2k per entry). Anybody have any ideas
on whats going on here? This is a real problem because I need to store
about 1.3 million entries.
I am using Visual C++ 7.0.

David Chazin
Nov 16 '05 #1
1 1685
Hello David,
Have you looked at the map size as you add items, it could
be that the map allocates 2MB as the 'initial chunk'. In
other words, no matter whether you add 100 or 1000 entries
the map will initially size to 2MB.
-----Original Message-----
I have simple hash_map<int, int>. When I insert 1000 entries my memorygrows by about 2 MB (or almost 2k per entry). Anybody have any ideason whats going on here? This is a real problem because I need to storeabout 1.3 million entries.
I am using Visual C++ 7.0.

David Chazin
.

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Charles Herman | last post by:
I have the folowing program: #include <iostream> #include <ext/hash_map> using namespace std; using namespace __gnu_cxx; typedef hash_map<char*, long, hash<char*> > char_hash_t;
2
by: gibffe | last post by:
Hello I have a big problem with hash_map in stl. I'm trying to create hash_map<const char *, char *> map to keep key => val pairs as 4 byte C "strings". Everything is ok when i do let's say...
0
by: Jon Cosby | last post by:
Why does this work std::hash_map <int, int> hm1; typedef pair <int, int> pr1; hm1.insert(pr1(1, 20)); cout << "First value is " << hm1 << endl; but not this using namespace std;
3
by: kony | last post by:
Hi there, I would much appreciate your help with the following problem. Below is the code that uses a hash_map. I want to release all the memory occupied by the hash_map for other use. Apparently...
4
by: lokki | last post by:
Hello, can anybody tell me what's wrong with following example code? char *k, *v; k = new char; strcpy(k, "a2"); v = new char;
3
by: saneman | last post by:
I have read that hash_map is not part of the C++ standard and therefore std::hash_map does not exist (even though it can be found in sgi). But is hash_map not just a std::map thats more efficient...
1
by: joseysaac | last post by:
i have this code in a archive called ffont.h #ifndef FFONT_H_FILE #define FFONT_H_FILE #include "FBase.h" #include "FShape.h" #include <vector> #include <hash_map>
2
by: Harinezumi | last post by:
Hi, I want to use SGI's hash_map in my code, but when compiling (with gcc 3.3.3) I get the following error: hash_map_test.h:3: error: syntax error before `;' token I reduced the code to...
4
by: James Kanze | last post by:
On Jul 16, 10:53 pm, Mirco Wahab <wa...@chemie.uni-halle.dewrote: It depends. You might like to have a look at my "Hashing.hh" header (in the code at kanze.james.neuf.fr/code-en.html---the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.