I have no idea, just a small note though: you initialize sw and allocate a new object to it, however, when the method doesn’t find the info you need, it returns null, but doesn’t destroy sw, perhaps you should do it, to avoid memory leaks?
Thanks for the tip, . I’m still new to c++ after coming from c#. Question though, isn’t this stack allocation - meaning the memory will be freed once it’s taken off the stack?
You will have to de-allocate everything you initialize using the “new” keyword. UE4 does include its own garbage engine, but it wont apply in this case.
For stack allocation you have to use alloca(object) (or _alloca don’t quite remember sorry) be careful though, keep in mind it will be deleted once you reach the end of the method, not when it goes out of scope.
e.g.
void Foo::DoSmth()
{
char* mychar = malloca(5);
(....)
return;
//malloca gets deleted here
}
void Foo::DoSmthElse()
{
for(int i=1; i< YourCondition; ++i)
{
char* mychar = malloca(i);
}
(....)
return;
//malloca will ONLY delete the last memory allocation for mychar, so all the other instantiations (memory allocations) will still be there = memory leak
}
Can I bump this since I posted it on the weekend? It’d be nice to get some staff insight on the error message.
Alternatively, is there another method of getting external WAV audio to play within the engine? It seems like this should be something in-built, like Unity’s WWW class.