Re: NSView out of memory problem
Re: NSView out of memory problem
- Subject: Re: NSView out of memory problem
- From: Jean-Daniel Dupas <email@hidden>
- Date: Tue, 1 Apr 2008 15:09:14 +0200
Le 1 avr. 08 à 14:50, Matt Gough a écrit :
On 1 Apr 2008, at 14:40, Leslie Smith wrote:
I'm sure I'm missing something.
Yes. An understanding of Autorelease pools (and presumably Cocoa
memory management in general)
http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html
The unoptimal way to fix your memory usage would be:
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
p1 = [NSBezierPath bezierPath] ;
[p1 moveToPoint: linebottom] ;
[p1 lineToPoint: linetop] ;
[p1 stroke] ;
[pool release];
Matt
Yes, an a better way to fix it will be to use a static method:
[NSBezierPath strokeLineFromPoint: linebottom toPoint: linetop];
It will avoid creation of an object for each segment.
_______________________________________________
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