What actually happens when objects are dealloc'd in Objective-c?
I'd like to understand Objective-c's memory management at a lower level. Say I have 100 bytes allocated on the heap to some Objective-c object. What happens to this 100 byte block when the object is dealloc
'd?
I'm curious about how the runtime knows that a bl开发者_JAVA技巧ock of memory is available for re-use after it's dealloc
'd. What happens to the actual bytes? Are they set to random values? Or perhaps they keep their values and just get overwritten by other objects later.
They keep their value but are marked as unused and overridable.
This behavior is just like the malloc & free functions in C.
精彩评论