3 ms·
Good article, so glad to find it here. I wish, though, that the authors had talked a lot more about memory management in Objective-C, because this had a major i
by herodotus 6y ago
Good article, so glad to find it here. I wish, though, that the authors had talked a lot more about memory management in Objective-C, because this had a major impact, not only on the development of Objective-C, but also on Swift. As far as I can tell, the idea of (explicit) reference counting came from Next, when Blaine Garst and others were working on remote objects. When I joined Apple (and therefore had to learn Objective-C), the most important task was to understand reference counting and memory management. Yes, there was a lot more, like interfaces, properties and the many libraries, but understanding alloc/new/release/autorelease was crucial for shippable software. GC was introduced (and deprecated) during my time, but it was the realization (presumably by Lattner and his team) that the LLVM analyzer could do a better job than humans at managing reference counting that was huge. No more hours and hours hunting down memory leaks! And, of course, only one concept required in Swift, namely weak vs. strong references.
In summary, a terrific paper, but it is too bad that this crucial part of the story is missing.
- gdubs 6y agoIndeed; reference counting was one of the most important aspects of Objective-C. Probably the most difficult aspect of it was that while most of the time method names have hints as to what increased a reference count, it wasn’t always obvious. And then, of course, you had Core Foundation functions which could be tricky to grok in terms of memory.
- asveikau 6y ago> As far as I can tell, the idea of (explicit) reference counting came from Next, Maybe in objc, but in the general case I kinda doubt this. It's a very common pattern in kernel development as an example, haven't done any archeology here but I have seen it in codebases rooted in the 80s at latest, probably earlier. (Did original Unix reference count file objects in the FD table the same way a modern kernel would? Would not be surprised if yes.) Autorelease is pretty unique though and clever.
- herodotus 6y agoGood point. I really meant reference counting as implemented in the Objective-C runtime architecture.
- pmcjones 6y agoI believe this is the first paper to describe reference counting: George E. Collins. A method for overlapping and erasure of lists. Commun. ACM 3, 12 (Dec. 1960), 655–657. https://doi.org/10.1145/367487.367501 https://doi.org/10.1145/367487.367501