[swift-evolution] [swift-evolution-announce] [Review] SE-0184: Unsafe[Mutable][Raw][Buffer]Pointer: add missing methods, adjust existing labels for clarity, and remove deallocation size
Andrew Trick
atrick at apple.com
Thu Sep 7 19:46:36 CDT 2017
> On Sep 7, 2017, at 5:40 PM, Joe Groff <jgroff at apple.com> wrote:
>
>
>>
>>> But then given that, I don't understand why the 'capacity' parameter is necessary. Under what circumstances would it actually be faster than "just" calling malloc_size?
>>
>> The runtime may need to hash the address or traverse a lookup table to find out which allocation pool the block resides in. Now, that’s only if some platform ditches full malloc compatibility for user allocations, so I’m not sure how realistic it is.
>
> It seems to me that you could still provide malloc/free compatibility with a zone that had to do a relatively expensive traversal on free() to recover the pool the memory came from; malloc/free just wouldn't be the ideal interface in that situation.
>
> -Joe
Joe is right, and I just learned how amazing malloc zones are.
-Andy
More information about the swift-evolution
mailing list