I am writing a small simulation program where I make thousands of a function calls to simulate a location based problem. When I use the program to simulate , for instance, at about 60 locations the program works fine. However when I tried to simulate it for 100 locations the program crashed showing the error message below, it does not point out the exact line though. I have tried to simulate each individual points separately it works fine. The problem occurs when increasing the number of simulation locations just above 60. I have tried to carefully release all the dynamically allocated memory to avoid any memory leak. Can someone help me figure out the problem please.
Unhandled exception at 0x7519c41f in myProg.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x006ca3a8..
First-chance exception at 0x7519c41f in myProg.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x006ca3a8..
std::badalloc is thrown by new when it fails to allocate memory correctly.
To the OP:
How big are the objects representing these locations that are being instantiated? Is it possible they're big enough that your system is simply running out of memory?