I am using CFSTR
function for creating CFString from constant c string and i am calling this function very frequently in my Daemon.
From documentation:
A value returned by CFSTR has the following semantics:
Should i use retain and release ?
As the documentation states, CFSTR()
created strings remain valid until the program terminates. You can release them all day long, but they won't actually be deallocated. For that reason, there's no need to explicitly retain/release them. It's valid to retain/release them because otherwise, you couldn't pass them around through other code that retains/releases them (framework methods, etc). Treat them like you would NSString literals created using @""
, that is to say, no need to retain or release them after creation, but if you're writing code that can take any CFString, you need to follow normal memory management rules, including using CFRetain()
and CFRelease()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With