Question

I am getting an occasional "C++ exception: std::bad_alloc at memory location" with the following code.

LPDIRECTSOUNDBUFFER8* ppDirectSoundBuffer;
ppDirectSoundBuffer = new LPDIRECTSOUNDBUFFER8[1];

This code is called on boot/init. I can run the app 10 times and this exception will get thrown about 1 time.

The randomness makes me think un-itialized variables. But as you can see, the code is pretty plain.

Any ideas?

Thank you

Was it helpful?

Solution

So I figured this out. I was writing past the bounds of an array a few lines above this new call. Silly mistake =/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top