Re: NSData questions (including Altivec)
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