Crash when freeing memory.
I'm having a problem when I try to free memory. I have my own struct to store info, its called SoundNode, and I have an STL vector to store all the SoundNodes in the scene, here is the code:
Now in the destructor of my scene manager I call a function called freeMemory() that frees all the memory allocated before (I don't put the code in the actual destructor because in some cases I want to free the memory of the scene manager without actually destroying the object). Now my freeMemory() function looks like this:
std::vector<SoundNode *> SceneNodes;
Now, when I run this in debug mode inside Visual Studio 2003 everything works fine. But if I run the same executable outside Visual Studio the application crashes when I try to delete SceneNodes[i]. Any idea what's wrong with my code?
for(int i = 0; i < (int)SceneNodes.size(); ++i)
SceneNodes[i] = NULL;
Thanks in advance.