Search code examples
objective-ccocoamemory-leaksnsworkspace

Opening url with Cocoa button causes memory leak


I have a button in my Cocoa app that opens a url in the web browser. If the browser is not open when the button is pressed then I get a memory leak. If the browser is already open then I do not get the memory leak.

The code for the button is:

- (IBAction)goToWebsite:(id)sender {
    [[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString:@"http://www.website.com/?apiref=123"]];
}

The memory leak as described in Instruments is:

Leaked Object = Malloc 2.00 KB
Number = 1
Address = 0x7f8003039600
Size = 2.00 KB
Responsible Library = libsystem_sandbox.dylib
Responsible Frame = sandbox_extension_issue

How do I prevent this memory leak?

This is my first time testing an app for leaks so any help with this problem would be greatly appreciated. I'm using Xcode 4.3.3 and OSX 10.7.4


Solution

  • There's nothing you can really do about this other than file it with apple as a bug