I don't have the code in front of me & I'm using a SDK. I will try to reproduce the code from memory. I need to know the best way release memory back from when I create new objects from calling new.
I have a public member variable (vector of pointers), that is passed by address to a different class member function. There its filled with the address of a new object.
After it is filled in that class member function, it is used in another member function WITHIN its class.Code:for (unsigned int h = 2; h < ArenaSize; h+=3){ if(ArenaBuffer[h] > THRESHOLD){ Rx = h%WIDTH; Ry = h/HEIGHT; RedXY *XYobject = new(nothrow) RedXY; XYobject->iX = Rx; XYobject->iY = Ry; (*vPixels).pushback(XYobject); } }
Do I step through the vector and use delete on the iterator?Code:pBitmap->drawline(RGB(255,255,255), (*it)->iX, (*it)->iY, (*it)->iX+1, (*it)->iY+1);
or can I useCode:delete (*it);
This is used for real-time video processing and objects are being created at 30Hz What is the best way to release memory that was used in making an object with new?Code:(*vPixels).clear();



LinkBack URL
About LinkBacks


