• 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: NSMakePoint and such - what about memory allocation?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMakePoint and such - what about memory allocation?


  • Subject: Re: NSMakePoint and such - what about memory allocation?
  • From: Greg Hulands <email@hidden>
  • Date: Fri, 21 May 2004 12:55:28 +1000

NSPoint is just a struct, so it is on the stack frame which will get deallocated once the current method ends.

On 21/05/2004, at 12:17 PM, Christoffer Lerno wrote:

Having programmed java almost exclusively for many years now, memory allocation questions in obj-c sometimes leave me a little confused.

If I use NSMakePoint in this manner:

NSPoint a=NSMakePoint(10,10);

Am I not:

a) first creating an empty, static bound, NSPoint.
b) then allocate memory and create yet another NSPoint with the NSMakePoint command.

The static NSPoint will disappear when it runs out of scope, but what about the point created with NSMakePoint, isn't that one dynamically created and as such needs to be explicitly deallocated? I don't really see any code actually deallocating these kinds of structs though, so I'm suspecting I don't need to, but if so - why?


/C
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >NSMakePoint and such - what about memory allocation? (From: Christoffer Lerno <email@hidden>)

  • Prev by Date: Re: Localizations question
  • Next by Date: Re: Avoiding == and = mixup in if statements
  • Previous by thread: NSMakePoint and such - what about memory allocation?
  • Next by thread: Re: NSMakePoint and such - what about memory allocation?
  • Index(es):
    • Date
    • Thread