Re: Leaks with savepanel
Re: Leaks with savepanel
- Subject: Re: Leaks with savepanel
- From: "Rob Napier" <email@hidden>
- Date: Tue, 18 Mar 2008 20:17:26 -0400
Is this your entire program? I've built it and don't see any leaks in
Instruments over short runs (actually I noticed a 1-time leak of an
NWNode object). Over a longer run, I wouldn't be shocked if you
encounter a small number of leaks in Cocoa itself. You're showing a
total of 200 leaked bytes here. That's going to happen. What you want
to watch out for are any leaks that steadily grow over time (even if
slowly). A one-time leak of 64 bytes here and there is not going to
cause you trouble and is normal for a Cocoa program (even if it
shouldn't be).
So the short answer is: don't worry about it (unsatisfying as that can be).
-Rob
On Tue, Mar 18, 2008 at 6:49 PM, Mr. Gecko <email@hidden> wrote:
> I don't see where the leak is but there is a leak in this code.
> mainWindow.h
> #import <Cocoa/Cocoa.h>
>
> @interface mainWindow : NSObject {
> }
> - (IBAction)button:(id)sender;
> @end
>
> mainWindow.m
> #import "mainWindow.h"
>
> @implementation mainWindow
> - (IBAction)button:(id)sender {
> NSSavePanel *panel = [NSSavePanel savePanel];
> [panel setTitle:NSLocalizedString(@"save", @"save panel")];
> [panel setPrompt:NSLocalizedString(@"save", @"save panel")];
> [panel setTreatsFilePackagesAsDirectories:NO];
> [panel setRequiredFileType:@"rtf"];
> [panel runModal];
> }
> @end
> Here is the out put of Instruments
> Self% Self Size Address Leaked Object
> 30.7 64B 0x1aeab0 NSCFString
> 23 48B 0x1aeb10 GeneralBlock-48
> 15.3 32B 0x1adc20 NSCFString
> 15.3 32B 0x1adfb0 NSCFArray
> 15.3 32B 0x1aeb40 NSCFSting
> Note that I am new to cocoa and instruments.
> _______________________________________________
--
"Those who would give up essential liberty to purchase a little
temporary safety, deserve neither liberty nor safety." -- B. Franklin,
Printer
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden