allocWithZone: Why doesn’t it matter much nowadays.

From StackOverflow : What is difference between alloc and allocWithZone?

Correct. The reality, though, is that pretty much nothing uses zones. It was originally intended to give the ability to, say, co-locate all of the objects related to a document in a zone and then bulk destroy them by simply deallocating the zone. In practice, this proved unworkable and zones haven’t been used in more than a decade in the OpenStep APIs.

In my case, why I didn’t use allocWithZone: much is because I believe my code should be fast and efficient enough even without memory zone. For special case where we want to make memory allocation/deallocation fast, we can use memory zone, but nowadays ARC takes care of memory allocation. If people are OK with ARC largely, there will be less and less people who care about allocWithZone.

For Windows, my team had used our own special allocation ( malloc/free/new/delete ) functions in C++ to allocate a big chunk of memory and give back memory aligned portions of the allocate space to callers of those new memory allocation/deallocation functions/methods.
For environment which requires really fast operation, it was beneficial.
So, for that.. probably still allocWithZone is useful.. but as said above.. who cares?


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: