• 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: NSData questions (including Altivec)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSData questions (including Altivec)


  • Subject: Re: NSData questions (including Altivec)
  • From: Paul Sargent <email@hidden>
  • Date: Tue, 21 Sep 2004 12:39:26 +0100

Whoops, forgot I started this thread !?! Brain Fade!

Timo Naroska wrote:

Hi,

there's also the possibility of allocating the data buffer yourself via malloc()
and creating the NSData object with a no-copy initializer like:


+ (id)dataWithBytesNoCopy:(void *)bytes length:(unsigned)length
or
+ (id)dataWithBytesNoCopy:(void *)bytes length:(unsigned)length freeWhenDone:(BOOL)freeWhenDone;

Point of interest - I noted that freeWhenDone requires that the buffer is allocated with malloc().


So, I reckon it does use malloc() for it's internal allocation, but this ....


Nicko van Someren wrote:


True, but I can't see guarantee that NSObject uses, or will use in the future, malloc() and related functions for its memory allocation. The current implementation may well have desirable properties but as long as the behaviour is not documented there is nothing to stop it being changed in the future, so I stand by my suggestion not to count on it. If you do choose to rely on it in your code then leaving in an assertion check will save some debugging time in the future if it does change.


Nicko

... is sensible advice.

Paul
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: NSData questions (including Altivec) (From: Nicko van Someren <email@hidden>)
 >Re: NSData questions (including Altivec) (From: "Sean McBride" <email@hidden>)
 >Re: NSData questions (including Altivec) (From: Nicko van Someren <email@hidden>)
 >Re: NSData questions (including Altivec) (From: Timo Naroska <email@hidden>)

  • Prev by Date: Re: NSData questions (including Altivec)
  • Next by Date: Re: Select a NSBezierPath
  • Previous by thread: Re: NSData questions (including Altivec)
  • Next by thread: Resampling/resizing pictures (solved but why ?)
  • Index(es):
    • Date
    • Thread