You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have set_label methods, which use nsstring_from_str, which uses auto-release pool. This is inviting for leaks in user code. There is no reason why set_label should use any auto-release pools, technically.
Proposal - split nsstring_as_str into separate methods for creation of an NSString and borrowing it as str. This way, the calling code is responsible for freeing it when needed. don't autorelease NSString. Instead, return an object that the caller can free explicitly by dropping. The caller is our own method in this case, so we can ensure the lifetime is correct.
The text was updated successfully, but these errors were encountered:
We have
set_label
methods, which usensstring_from_str
, which uses auto-release pool. This is inviting for leaks in user code. There is no reason whyset_label
should use any auto-release pools, technically.Proposal -
splitdon't autoreleasensstring_as_str
into separate methods for creation of anNSString
and borrowing it asstr
. This way, the calling code is responsible for freeing it when needed.NSString
. Instead, return an object that the caller can free explicitly by dropping. The caller is our own method in this case, so we can ensure the lifetime is correct.The text was updated successfully, but these errors were encountered: