我的应用程序中出现了以下类型的内存泄漏 - 仪器检查。我已正确分配&取消分配每个对象。但是我得到了这种类型的内存泄漏。
std :: _ Deque_base< __ CFURLCacheNode *,std :: allocator< __ CFURLCacheNode *> > :: _ M_allocate_node()
产生这种泄漏的原因是什么?
为什么发生内存泄漏?
图片: -
alt text http://img197.imageshack.us/img197/9571/problem151.png
alt text http://img194.imageshack.us/img194/6181/problem152.png
alt text http://img194.imageshack.us/img194/8035/problem153.png
alt text http://img193.imageshack.us/img193/6092/problem154.png
答案 0 :(得分:10)
在appDidFinishL中实现以下代码。功能
没有泄漏
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// Override point for customization after app launch
NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil];
[NSURLCache setSharedURLCache:sharedCache];
[sharedCache release];
[window addSubview:[navigationController view]];
[window makeKeyAndVisible];
}
答案 1 :(得分:1)
您在手机或模拟器上进行了分析吗?
我听说在模拟器上NSURLConnection
类中有内存泄漏。
来自http://www.iphonedevforums.com/forum/general-development-questions-advice/1086-memory-leaks.html
NSURLConnection类本身在OS 2.x中的sendSynchronousRequest方法中有泄漏。这是Apple完全清楚的问题。