memory leaks

I’m actually cleaning my code for a performance we will do with ipad.
I got some memory leaks left on string alloc that I didn’t figure to correct.
One is in my loading movie function loadMovie(ofxiPhoneGetDocumentsDirectory()+path); on the ofxiPhoneGetDocumentsDirectory() call. If I remove this call and add the video directly into the data folder of the apps, this leaks disappear. I add a look on the function, but everything seems fine and the NSArray allocated in the function should be managed by the NSAutorelease pool, right?
The second one is in ofxOscReceiver::Process(). Instruments indicates a leaks on a string either. I can’t figure where it comes from, every OscMessage and arguments created are deleted fine.
Any idea where to look at?

![](http://forum.openframeworks.cc/uploads/default/1790/Capture d’écran 2011-08-18 à 15.49.37.png)

you prompted me to browse around in the code. the only thing that occured to me is that in ofxOscMessage::clear() (called by its destructor), the member string remote_host does not get set to “”, but the address string does. Maybe that’s a possible reason, but I’m not sure this is actually necessary to do. (Don’t know why it gets done for the address, though).

Also, ofxOscReceiver contains virtual functions, but a non-virtual destructor. According to the book I’m currently reading (Effective C++ by Scott Meyers) that’s a bad idea. Would have to read up on why, though.

I already setted the remote_host to “”, doesn’t change anything.
I now think it comes from elsewhere in my VideoPlayer implementation. By printing in the contructor destructor, I noticed the destructor is not called. The video player herits from a sprite class and is declared like this :
MySprite * player1 ;
and allocate like that : player1 = new MyVideoSprite();
who it called MyVideoSprite constructor()
but I just noticed that when I call delete player1, it called the destructor of MySprite and not the one of MyVideoSprite(). Most stuff in MyVideoSprite is deleted in a close() function that is also called when I stop the player, so I didn’t noticed that before. I’m now pretty sure the leaks come from here.
I tried few times ago to change the destructor in virtual but I get linking problems. I will look more deeper in that way.
Thanks!
Thomas.

can you post the code of the relevant classes?

Was definetly my classe. That’s now fine.
Still some memory leaks on sound side. Will have a look now.
There is a public git repo in access only here : git://creapach.repositoryhosting.com/creapach/risk0.git

Thanks again!