ofTexture buffer from vidGrabber

Hi folks! New here, this is my first project in oF.
What I’m trying to do is to build a video scratcher by filling in a buffer from my webcam and playing it back.
I’m using a vector of ofTexture for memory optimization. At each update cycle I store the current frame in an ofImage (named colorImg) and then pass it to the vector. Everything works fine, except that when I try to store for example one minute of video (3600 frames) I still have 2gb ram usage. Does the ofImage allocate a new one at each cycle? How could i solve this?

Thanks!
daniele

vector<ofTexture> buffer;

void ofScratcher::write(ofImage *frame){
    buffer[wPos].allocate(*frame);
}

void ofApp::update(){
    ofBackground(100,100,100);
    bool bNewFrame = false;
    vidGrabber.update();
    bNewFrame = vidGrabber.isFrameNew();
    
    if (bNewFrame){
        colorImg.setFromPixels(vidGrabber.getPixels());
        scratcher.write(&colorImg);
    }
    
    scratcher.setwPos();
    scratcher.setrPos();
}

The graphics card offloads memory to ram if it can’t fit in it’s own memory. with 3600 frames even at 640x480 that would be: 640x480x3x3600~=3Gb if your card has 1Gb minus whatever is already in use the rest goes to RAM which accounts for 2Gb not sure what resolution are you using but 2Gb for a minute of video is normal.

Oh now it’s all clear, Didn’t know about this self offload memory. Thanks a lot Arturo!