We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
想确认下理解的对不对, 判断 retainCount = 2的对象是应该被release的对象的依据是, 在themeColorPool中有retain了一次, 然后在 copy的时候又retain了一次, 而其他正在使用的对象的retainCount一定是大于2的。 这样理解对么?
// 遍历主题色池(移除应该被回收的对象) for (NSDictionary *dict in [[self themeColorPool] copy]) { // 取出key NSString *objectKey = nil; for (NSString *key in [dict allKeys]) { if (![key isEqualToString:PYTHEME_COLOR_ARGS_KEY]) { objectKey = key; break; } } // 取出对象 id object = [dict valueForKey:objectKey]; // 取出对象的引用计数 NSInteger retainCount = [[object valueForKey:@"retainCount"] integerValue]; if (retainCount == 2) { // 对象应该被回收了 [[self themeColorPool] removeObject:dict]; } }
The text was updated successfully, but these errors were encountered:
@zedzhao 使用retainCount 还是不够合理的,现在最新的方案是采用NSMapTable对对象采取弱引用,具体讨论见:#2
Sorry, something went wrong.
No branches or pull requests
想确认下理解的对不对,
判断 retainCount = 2的对象是应该被release的对象的依据是, 在themeColorPool中有retain了一次, 然后在 copy的时候又retain了一次, 而其他正在使用的对象的retainCount一定是大于2的。
这样理解对么?
The text was updated successfully, but these errors were encountered: