Looping the app with new ofApp

Hi, i would like making an app that it can inicializate without exit, looping all the time and erasing the variables’s values every time. i was testing put directly ofRunApp(new ofApp()) at the end of the loop (after showing the results of the interaction with one graph), but this function don’t erase the last values, it remains and the values are adding with the news one, and when i show the results i have the last one and the news one Can you help me? I was testing erasing the vectors with the erase function, but it seems don’t work… if you know any example …
Thanks a lot

i am not 100% sure how your setup looks like.
maybe post a sample example project that illustrates the problem.

in terms of reusing a vector you could take a look at the networkUdpSenderExample that comes with the openframeworks example folder.

//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button){
	stroke.push_back(ofPoint(x,y));
}

//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button){
	stroke.clear();
}

s.

Hi thanks,
shure, here my code is:

the function is named clean(), and it is for restarting the app: cleaning the screen and the variables and calling again the setup() function for initializating the variables again, the thing is that when i call elementos.clear() the size of the vector is 0, but when i call the ofRunApp(new ofApp());, the size has the double size, so elementos.clear() seems not erase the objects…
thanks

void ofApp::clean(){

//vector array's name: elementos

//metodo 1--destructor

// for (int n=0; n<elementos.size();n++){
// elementos[n]->~elemento();

// }

//metodo 2-erasing

// for (int n=elementos.size(); n>0 ;n--){
//   elementos.erase(elementos.begin());

// }



elementos.clear();

fbo.clear();
ofRunApp(new ofApp());

}

i am not sure why you need to restart the app.

but here is some simple code that calls the setup() function and seem to do what you are asking for.

yes, Stephan, it seems to work fine, i was complicating this so much,
thanks a lot,