Re: copy object in kCFAllocatorMallocZone to scanned zone?
Re: copy object in kCFAllocatorMallocZone to scanned zone?
- Subject: Re: copy object in kCFAllocatorMallocZone to scanned zone?
- From: Michael Link <email@hidden>
- Date: Tue, 23 Dec 2008 13:25:06 -0600
On Dec 23, 2008, at 1:19 PM, Michael Link wrote:
I have a situation with something like this is going on:
CFHTTPMessageRef response =
CFHTTPMessageCreateEmpty(kCFAllocatorMallocZone, FALSE);
CFHTTPMessageAppendBytes(response, bytes, length);
if (CFHTTPMessageIsHeaderComplete(response)) {
CFIndex statusCode = CFHTTPMessageGetResponseStatusCode(response);
NSDictionary* headerFields =
(NSDictionary*)CFHTTPMessageCopyAllHeaderFields(response);
}
Which is taking place in a garbage collected environment. Would the
headerFields variable use the same allocator used to create the
response (kCFAllocatorMallocZone) or would it be using the default
allocator which would mean that it would be in scanned memory?
If headerFields is allocated with kCFAllocatorMallocZone, and I copy
like this:
NSDictionary* headerFieldsCopy = [headerFields copy];
Would the copy be allocated with kCFAllocatorMallocZone or the
default allocator?
I would like to copy headerFields to scanned memory because it could
be passed as the argument to something that assumes it is in scanned
memory.
Would this be the correct way to copy the dictionary from the malloc
zone to the scanned zone?
NSDictionary* headerFieldsCopy =
(NSDictionary*)CFDictionaryCreateCopy(NULL,
(CFDictionaryRef)headerFields);
--
Michael
_______________________________________________
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