set<>.insert() -> std::bad_alloc, but only in debugger???

Hi,

I just started c++ after 10 years again. Seems like I have to learn from scratch.
I've written a small genetic algorithm which now seems to run (debug & release version) for hours w/o problems.

But if I run it in debugger I get std:bad_alloc after 5sec no matter if I use mingw/code::blocks or VS08. In the code line I insert a struct{int, char (just 1 char)} into an according STL set which gets max 100 elements.


As far as I understood std::bad_alloc indicates that there's not enough memory to allocate.

I cannot explain this. I don't seem to have a memory leak if I watch for hours in taskmanager it just shows 4MB and I have 3GB.

Is less memory available during debugging???
Is there a problem with the debugger?
Does this error also happen outside debugger, but only comes up within the debugger?

While VS08 showed me the callstack and I could see my line of code, CODE::BLOCKS just shows me a "ntdll!rtlduplicateunicodestring()". But from the state of the console output I guess it happened at the same place.


any ideas?

Can you show some code? Duplicate with a small example if possible and then post for others to analyze and/or execute.
Topic archived. No new replies allowed.