我在我的 Mac OS X 应用程序上以Xcode 4.5
. 我有两个NSOperation
依赖子类,在将它们添加到进程队列后忘记释放它们。所以我在将它们添加到队列后就释放了它们。该应用程序运行良好。我在 Instruments 上对其进行了分析,但它崩溃了。
processQueue = [[NSOperationQueue alloc] init];
NSUInteger max = [[NSUserDefaults standardUserDefaults] integerForKey:@"jobsKey"];
processQueue.maxConcurrentOperationCount = max;
GeocacheDownloadOperation * downloadOp = [[GeocacheDownloadOperation alloc] initWithGeocache:cache InPath:directoryPath withDelegate:self];
GeocacheJPGConversionOperation * conversionOp = [[GeocacheJPGConversionOperation alloc] initWithCache:cache WithPath:directoryPath WithDelegate:self];
[conversionOp addDependency:downloadOp];
[processQueue addOperation:downloadOp];
[processQueue addOperation:conversionOp];
[downloadOp release];
[conversionOp release]; //This line makes Instruments crash
Instruments
当我想释放最后一个操作时崩溃(参见代码),但应用程序似乎运行良好。
有人有建议吗?是仪器错误还是我编码错误?