Hi hi I’m having an issue with an iOS app running out of memory and crashing.
When the app runs on an iPad and we follow the RAM consumption from xcode, one single line is responsible for grabbing several megabytes per captured webcam frame.
// MAIN. Draws the webcam and a logo with a simple shader to an FBO
// sends the FBO to videoGen.
...
fbo.begin();
shader.begin();
webcam.draw(area1);
logo.draw(area2);
shader.end();
fbo.end();
videoGen.addFrame(fbo);
...
// VIDEOGEN. Has a vector of FBO allocated in its setup().
videogen::setup() {
for(size_t i = 0; i < 24; i++) {
ofFbo t;
t.allocate(w, h, GL_RGBA);
framesFbo.push_back(std::move(t));
}
}
// here we draw the received webcam image onto one of the FBOs in the vector.
videogen::addFrame(ofFbo & fbo) {
f++;
framesFbo[f].begin();
ofSetColor(ofColor::white);
fbo.draw(0, 0); // <-- *** THIS LINE MAKES THE RAM GO UP ***
framesFbo[f].end();
// (unrelated stuff here...)
}
Since I’m not allocating any new FBOs while the program runs (only in setup), why does the memory usage go up when drawing an FBO onto another FBO?