4 ms·
why I'm glad to be writing objective-c and getting free reference counting built it :-)
by zbowling 16y ago
why I'm glad to be writing objective-c and getting free reference counting built it :-)
- hardy263 16y agoExcept apple advises you not to use reference counting when trying to debug. So when reference counting doesn't work, you still have to go back and manually count the references yourself...
- ryannielsen 16y agoApple doesn't advise developers to avoid ref counting, it advises them to avoid using -retainCount. -retainCount is a weak debugging tool, at best. It doesn't take into account autorelease pools, to start, and any framework-specific memory management is ignored. Its use is discouraged for good reason. For better tools, check out Instruments, MallocDebug or leaks. Or read Apple's Memory Usage Performance Guidelines, specifically the "Finding Memory Leaks" section. [1] Apple's Technical Note TN2124 "Mac OS X Debugging Magic" even has, in the Cocoa section, an example of how -retainCount can be misleading and confusing. [2] Nowhere does Apple advise Cocoa developers to avoid ref-counting. Cocoa's ref-counting/GC'd memory management system is considered a huge advantage for the platform. [1] http://developer.apple.com/library/mac/#documentation/Performance/Conceptual/ManagingMemory/Articles/FindingLeaks.html http://developer.apple.com/library/mac/#documentation/Perfor... [2] http://developer.apple.com/library/mac/#technotes/tn2004/tn2124.html http://developer.apple.com/library/mac/#technotes/tn2004/tn2...
- DougBTX 16y agoAre you mixing up garbage collection and reference counting? I can understand a suggestion to turn off garbage collection if you want to debug a non-garbage-collected, reference counted piece of code. Otherwise, a link to documentation which describes what you are talking about would clarify things.