ofZach / danceExchange

smirnoff nightlife exchange
1 stars 0 forks source link

need to delete / clear particles and dance videos. #8

Open ofZach opened 13 years ago

ofZach commented 13 years ago

do we ever delete particles? I see this, but never see any "delete"

void DPManager::createParticle( danceVideo * dv, bool shouldZoom ) {

if ( shouldZoom ) {
    cout << "gonna zoom a particle with id: " << dv->id << " and hash: " << dv->hash << endl;
}

DanceParticle *dp = new DanceParticle( dv );
dpVector.push_back( dp );
dpMap[dp->DV->hash] = dp;

dp->pos.set( frustumHelp.getRandomPointOnFarPlane() );
dp->vel.set( 0, 0, -ofRandom( 10.0, 20.0 ) );

if ( shouldZoom ) {
    zoomParticle( dp );
}

}

same thing with dance videos, just see adding: danceVideos.push_back( loadingVideo );

but no deleting, here, for example, I think we need a delete too, since this is just erasing the pointer, so it may be leaking memory.

unloadedDanceVideos.erase( unloadedDanceVideos.begin() );

we should investigate new operators that doesn't have an associated delete, and push_backs, without pop or erase....