开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜