Reputation: 277
I'm assuming the definition of alloc
goes along the lines of:
Locates and allocates a block of memory for an object
And the definition init
goes something like:
Creates an object in the newly allocated memory block
I'm just trying to wrap my head around more regarding memory management and want to make sure that I'm getting this right..
Upvotes: 1
Views: 63
Reputation: 14068
That is sort of right.
It is right in principle. But init
is actually not required to return the same, indentical, object. I never observed this (well, frankly, never checked for it either) but theoretically init
may release the allocated object, allocate another one, initialize the second and return a refernce to the second one.
Besides that detail you are totally right.
Upvotes: 1