For some reason the python extension object is not deleted when finished with.

    //clear up finished sounds
    for(std::vector<SourceVoice*>::iterator it=finished.begin();it!=finished.end();++it)
    {
        playing.erase(*it);
        (*it)->ob_refcnt--;//remove the refrence we added when we got the voice
        std::cout << "finished voice refrence: " << (*it)->ob_refcnt << std::endl; //prints 0
    }

class SourceVoice : public Py::PythonExtension<SourceVoice>
{
    IXAudio2SourceVoice *voice;
    Sound *sound;
public:
    static void init_type();
    SourceVoice(IXAudio2SourceVoice *voice, Sound *sound);
    virtual ~SourceVoice();

    IXAudio2SourceVoice *GetVoice(){return voice;}
private:
    Py::Object GetVolume(const Py::Tuple &args);
    Py::Object SetVolume(const Py::Tuple &args);
    Py::Object Stop     (const Py::Tuple &args);
    Py::Object ExitLoop (const Py::Tuple &args);
};

SourceVoice::SourceVoice(IXAudio2SourceVoice *_voice, Sound *_sound)
:voice(_voice), sound(_sound)
{
    sound->ob_refcnt++;
}
SourceVoice::~SourceVoice()//not called
{
    std::cout << "voice destroyed" << std::endl;
    sound->ob_refcnt--;
    voice->DestroyVoice();
}

Is there some reason why an object is not deleted even when the refcnt hits zero, in fact the objects are not even getting deleted when the python program ends, leaving windows to clear up 100's of MB's of sound data...


Great search results, great prizes. BigSnapSearch.com Search now