views:

197

answers:

1

I have a Windows C++ application that holds a std::hash_set containing abount 5 Million entries each with 32 Bytes. If i create the hash_set in a separate (of many) threads it uses > 1 GB according to ProcessExplorer. I see this when i free the list. If i create it in the main thread it ueses 200 MB. This phenomenon only applies to the 32-Bit Version of my application. It does not oocur with the x64 Version. I use a dual quad core with Win XP x64. Its not a memory leak. Everything is freed on clear().

My guess: Windows 32.Bit is not constructed for many threads / many cores.

What is your gues?

+6  A: 

The data structure ultimately allocates from the heap, and it's the same heap regardless of the thread. Making heap calls from a different thread is not going to affect the amount of memory allocated. Either your tools are lying to you, or you're allocating the hash_set on several other threads by accident.

Daniel Earwicker