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:
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
Post a Comment