问题描述
在一个基于文档的ARC应用程序中,我有一个WebView打开一个HTML文件。想法是做一些编辑,然后保存到WebArchive。当我运行仪器,我发现随机泄漏,如下图所示。我不是初始化任何东西与 malloc
,为什么我得到他们? (我开始打开和关闭窗口时会出现泄漏。)
In a doc-based ARC-enabled application I have a WebView that is opening an HTML file. The idea is to do some editing, and then save to WebArchive. When I run Instruments I find random leaks as in the image below. I am not initializing anything with malloc
, why am I getting them? (I get the leaks when I start opening and closing windows.)
Document.h
#import <Cocoa/Cocoa.h>
#import <WebKit/WebKit.h>
@interface KBDocument : NSPersistentDocument {
IBOutlet WebView *webView;
}
Document.m
- (void)windowControllerDidLoadNib:(NSWindowController *)aController
{
[super windowControllerDidLoadNib:aController];
NSString *urlStr = @"file:///Users/.........../Content/1/index.html";
NSURL *url = [NSURL URLWithString:urlStr];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[[webView mainFrame] loadRequest:requestObj];
[webView setEditable:YES];
}
漏洞:
推荐答案
好吧,你可以看到冒犯的库是libdispatch;所以它似乎没有你的代码是错误的。
Libdispatch 在这里描述。如果你想知道更多,你可以检查它。
Well, you can see that the offending library is libdispatch; so it doesn't seems that your code is in error. Libdispatch http://libdispatch.macosforge.org/ is described here. You could check it out if you want to know more.
这篇关于WebView:libdispatch在启用ARC的应用程序中泄漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!