• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSView out of memory problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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:57:00 +0200


Yes, I am. The doc says nothing but according to the assembly form of this method, it do something like this:


CGContextBeginPath()
CGContextMoveToPoint()
CGContextAddLineToPoint()
CGContextStrokePath()

Most of NSBezier method are just simple wrappers upon CoreGraphics equivalent.

An other way is to use CG directly. You can get the graphic context using

CGContextRef ctxt = [[NSGraphicsContext currentContext] graphicPort];


Le 1 avr. 08 à 15:17, Graham Cox a écrit :
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.



_______________________________________________

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


References: 
 >NSView out of memory problem (From: Leslie Smith <email@hidden>)
 >Re: NSView out of memory problem (From: Matt Gough <email@hidden>)
 >Re: NSView out of memory problem (From: Jean-Daniel Dupas <email@hidden>)
 >Re: NSView out of memory problem (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Custom interface
  • Next by Date: Re: Custom interface
  • Previous by thread: Re: NSView out of memory problem
  • Next by thread: Re: NSView out of memory problem
  • Index(es):
    • Date
    • Thread