Domanda

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

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top