objective c - Is CFRelease necessary here to prevent a leak? -


so i've heard new alloc , copy create new memory on heap responsible for. want make sure case c-function in core graphics:

myivar=cgdataprovidercopydata(cgimagegetdataprovider(cgimage));

does mean must release later like:

cfrelease(myivar);

in other words, if re-assign myivar later without release statement, cause leak?

regarding comments, i've uploaded screenshot:

enter image description here

the commented-out line works fine. prior line have m_parsedimage = cgdataprovidercopydata(cgimagegetdataprovider(cgimage)); works fine.

yes, function copy or create in name, convention, returns must release.

in case, quick @ docs cgdataprovidercopydata shows:

return value
new data object containing copy of provider’s data. responsible releasing object.

please take moment check docs before posting such questions. save lots of time. :)


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -