|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Freeing loaded sounds / memory leak woesHi,
I have a wrapper class for sound that calls a LoadSound function. Device is a AudioDevicePtr that is a private member of the class. I'm having a problem with the sound files not being freed when they're "out of scope". I narrowed the problem down to this (a different, simplified version of the LoadSound function) int SoundClass::LoadSound(.....) { audiere::OutputStreamPtr Data(audiere::OpenSound(Device, "test0.ogg ", false)); if (!Data) { return 0; } return 1;
} Since Data goes out of scope as soon as the function ends, it should free up the memory that was allocated, right? I find that when i call this function repeatedly, it nevers frees up the memory, causing a memory leak. However, i did find that if reassigned Device everytime that function got called, it would free up memory.
I am doing this right? What's the best way to free memory?
Thanks
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Audiere-users mailing list Audiere-users@... https://lists.sourceforge.net/lists/listinfo/audiere-users |
|
|
Re: Freeing loaded sounds / memory leak woesHello:
It looks like you're doing it right; you're using a smart pointer, so the memory should be freed as soon as that pointer goes out of scope. Which device implementation are you using, and which version of Audiere? Thanks. -- Matt Campbell Lead Programmer Serotek Corporation www.freedombox.info "The Accessibility Anywhere People" ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Audiere-users mailing list Audiere-users@... https://lists.sourceforge.net/lists/listinfo/audiere-users |
|
|
Re: Freeing loaded sounds / memory leak woesOS is Windows XP, Visual Express C++ is the compiler, Audiere version 1.9.4.
I've made a simple project that demonstrates the problem:
Note you'll have to set the working directory to "working" to run it from the IDE. You can also run the prebuilt .exe from the working folder.
I've run it through debugger and it seems like the number of calls to unref() matches up with ref(), so i don't know why it won't release the memory.
Thanks
On 11/2/06, Matt Campbell <mattc@...> wrote:
Hello: ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Audiere-users mailing list Audiere-users@... https://lists.sourceforge.net/lists/listinfo/audiere-users |
| Free embeddable forum powered by Nabble | Forum Help |