Take the 2-minute tour ×

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.)


#import <Cocoa/Cocoa.h>
#import <WebKit/WebKit.h>

@interface KBDocument : NSPersistentDocument {
    IBOutlet WebView *webView;


- (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];


enter image description here

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

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.

share|improve this answer
Thanks, I checked it out. I am new to cocoa, so the description doesn't make too much sense, it looks like it's for implimenting multi-tasking and using Grand Central Dispatch, rather than threads... I am not implementing anything like this in my code, so is it something I could safely ignore? –  janeh Mar 8 '12 at 4:56
Probably. The frameworks you are using will be doing some things with threads and GCD, but you don't have to worry about them. If you ever find a large leak you should file a bug report. –  JoshRagem Mar 8 '12 at 5:25
Btw, when I comment out all the code, i still get the leaks, but when I deleted the webView from the interface builder, leaks stopped showing up! –  janeh Mar 8 '12 at 22:10
add comment

Your Answer


