4 ms·
Apple tried to implement a garbage collector but they abandoned it later. May be they don't have good developers (but they got a lot of money so they probably c
by vbezhenar 11y ago
Apple tried to implement a garbage collector but they abandoned it later. May be they don't have good developers (but they got a lot of money so they probably can buy anyone) or reference counting isn't that bad in practice.
- lispm 11y ago> Apple tried to implement a garbage collector but they abandoned it later. May be they don't have good developers (but they got a lot of money so they probably can buy anyone) or reference counting isn't that bad in practice. Garbage Collection is not very good with a C-language. C is simply the wrong language to be used with GC - same for Objective C. Personally I would also not use a 'conservative GC' in this context. Additionally GC has some overhead and it is not going away: memory usage, responsiveness, etc.. Apple would need to switch to a real higher-level language with managed memory and a precise GC. GC, Swift and more RAM might have more chances.
- pjmlp 11y agoThey never managed to make it work without segfaults, due to the underlying C features.
- mikeash 11y agoIt worked fine if you followed the rules. The trouble is that the rules were kind of annoying to follow and weren't automatically enforced at compile time very well. More troublesome was the fact that a C collector necessarily needs to be conservative, and that means you lose out on nice advanced GC features like compaction.
- pjmlp 11y agoExactly, which was specially problematic with third party libraries. What proponents of ARC miss, is that Apple gave up on GC because they didn't managed to make it work with Objective-C semantics, not due to merits of RC over GC. Also Swift is also ARC based, because the goal is for a smooth integration with the Objective-C runtime, not due to merits of RC over GC.
- millstone 11y agoReference counting has a lower memory high-water mark than any GC, due to eager reclamation. This is important on a mobile device that does not page to disk, since it means that you have more memory available to actually use.