Re: NSView out of memory problem
Re: NSView out of memory problem
- Subject: Re: NSView out of memory problem
- From: Matthew Whillock <email@hidden>
- Date: Tue, 1 Apr 2008 16:23:52 +0100
The class reference has this to say about it:
Strokes a line between two points using the current stroke color and
the default drawing attributes.
+ (void)strokeLineFromPoint:(NSPoint)point1 toPoint:(NSPoint)point2
So it will just draw a line.
Cheers,
Matt
Are you sure? This could be just a convenient interface for creating a
bezier object with the points passed, stroking it and releasing or
autoreleasing it. The docs say nothing about how it's implemented.
A better idea might be to create ONE bezier object at the top of the
loop, collect all the lines into it, then stroke it in one go after
the loop terminates. I do this for drawing grids with many thousands
of lines and have never hit a memory problem so far.
------
S.O.S.
On 2 Apr 2008, at 12:09 am, Jean-Daniel Dupas wrote:
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.
--
Matthew Whillock
email@hidden
Mullard Space Science Laboratory
Holmbury St Mary
Surrey RH5 6NT
UK
_______________________________________________
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