Click here to Skip to main content
15,888,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Query related to STL, hash_multimap, C

using following code to insert 60,000 entries in hash_multimap container, each entry is, at MAX 270 bytes, as i run my program, i observe the program consumes 4.5 GB of RAM.

PS: as i debug my program, i tried to insert as

hashContainer.insert(Str_Pair("FFEC775ABDC37DED163B8B1896CABDCD2C392A04", "TEST"));

i notice for this single entry, 20 KB of memory increases.

Need your suggestion.



CODE:
hash_multimap<string,> hashContainer;
XML
typedef pair<string, string> Str_Pair;

CHAR szFileName[MAX_PATH] ;
wcstombs(szFileName, ptrFN, MAX_PATH);
string strHash(szHash);
string strFileName(szFileName);

hashContainer.insert(Str_Pair(strHash, strFileName));
Posted
Comments
Sergey Alexandrovich Kryukov 5-Nov-12 1:13am    
C++? Tag it.
--SA
Sergey Alexandrovich Kryukov 5-Nov-12 1:14am    
Are you just looking at Windows Task Manager? Don't trust it.
--SA

1 solution

If you think you may have memory leaks or over-consumption of memory, or face insufficient memory, Windows Task Manager won't help you. You should use one of the tools called memory debugger. Please find a suitable one here:
http://en.wikipedia.org/wiki/Memory_debugger[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900