• 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
NSView out of memory problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSView out of memory problem


  • Subject: NSView out of memory problem
  • From: Leslie Smith <email@hidden>
  • Date: Tue, 1 Apr 2008 13:40:06 +0100

Hi:

I have a Cocoa application which draws a (very) large number of line segments using the code below in a loop, in drawRect, in a subclass of NSView.

p1 = [NSBezierPath bezierPath] ;
[p1 moveToPoint: linebottom]  ;
[p1 lineToPoint: linetop] ;
[p1 stroke] ;

(These are the outputs from a neural network simulator.) I'm just using one NSView: if I draw a set of outputs, and then (later) draw another set of outputs (filling the rect with white in between), I eventually run out of memory. Clearly, I need to free up something but I really do not know what. (Well, I should probably create a new NSView each time, but I'd like a quicker fix.)

I tried [p1 release] ; after the code above, but that simply made the app crash.

I can't seem to find anywhere that tells me how to do this: it looks as though once I have drawn something in an NSView, using NSBezierPath, the memory used stays used. I'm sure I'm missing something.

--Leslie Smith


Professor Leslie S. Smith, Dept of Computing Science and Mathematics, University of Stirling, Stirling FK9 4LA, Scotland email@hidden Tel (44) 1786 467435 Fax (44) 1786 464551 www http://www.cs.stir.ac.uk/~lss/ UKRI IEEE NNS Chapter Chair: http://www.cs.stir.ac.uk/ieee-nns-ukri/




-- The University of Stirling (a charity registered in Scotland, number SCO11159) is a university established in Scotland by charter at Stirling, FK9 4LA. Privileged/Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not disclose, copy or deliver this message to anyone and any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. In such case, you should destroy this message and kindly notify the sender by reply email. Please advise immediately if you or your employer do not consent to Internet email for messages of this kind.


_______________________________________________

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


  • Follow-Ups:
    • Re: NSView out of memory problem
      • From: Graham Cox <email@hidden>
    • Re: NSView out of memory problem
      • From: Matt Gough <email@hidden>
  • Prev by Date: Best Way to Replicate CURL in Cocoa?
  • Next by Date: Re: Getting Localized System Strings
  • Previous by thread: Re: Best Way to Replicate CURL in Cocoa?
  • Next by thread: Re: NSView out of memory problem
  • Index(es):
    • Date
    • Thread