7 ms·
Would you mind elaborating on the "compile time reference counting"? Is this new? How does it handle cycles?
by calebwin 8y ago
Would you mind elaborating on the "compile time reference counting"?
Is this new?
How does it handle cycles?
- steveklabnik 8y agoA comparison to Swift's ARC would also be of interest :)
- Aardappel 8y agoYup, I will write up the algorithm some time soon. I've seen Swift's intentions to add lifetime analysis to ARC, but from what I could see it is much more complicated in Swift, requires annotations, and with significant runtime overhead remaining.
- steveklabnik 8y agoArc isn’t that stuff, Arc is what it already does today. “Automatic reference counting.”
- Aardappel 8y agoI'm aware of that, I said "add lifetime analysis to ARC", as in, ARC is what I call regular runtime reference counting, and with lifetime analysis some of it can move to compile time.
- steveklabnik 8y agoYep oops, sorry. Anyway, psyched to see more people experimenting with this kind of thing!
- Aardappel 8y agoYes, I frankly feel this design space is the future of memory management. GC, begone!
- alexisread 8y agohttp://concurrency.ch/Content/publications/Blaeser_Component_Operating_System_PLOS_2007.pdf http://concurrency.ch/Content/publications/Blaeser_Component... This seems to scale out very well - it's kind of static GC analysis with RAII and erlang-style messaging.
- Aardappel 7y agohttp://aardappel.github.io/lobster/memory_management.html http://aardappel.github.io/lobster/memory_management.html
- Aardappel 8y agoIt is so new I haven't even documented it yet.. hence why I said the timing for this HN post isn't great. So imagine the current implementation does a lifetime analysis somewhat similar to Rust, but then where Rust would error out, this implementation simply inserts a runtime refc increase. This gets rid of most runtime refc overhead without the programmer needing to be clever about it. Then, I intend to add an optional type annotation that gets you the Rust behavior, for those cases where you want maximum control. I don't think its the right default though. The algorithm is more lenient than Rust, since I don't have any shared memory concurrency for example. I intend to write up more thorough details about the algorithm, but again, haven't gotten to it. It does not handle cycles. If you create cycles that you do not manually break, you'll get a cycle report at program exit that prints the kind of values that weren't reclaimed. You're then expected to fix your code accordingly :)
- obastani 8y agoAny chance you could you share some references on this kind of type inference? It sounds very interesting!
- Aardappel 8y agoIt is not an implementation of an existing paper or anything.. I am going to write it up soon, promise! Feel free to email or msg me if you want to be notified.
- alexisread 8y agoYou could try: http://liu.diva-portal.org/smash/get/diva2:20899/FULLTEXT01.pdf http://liu.diva-portal.org/smash/get/diva2:20899/FULLTEXT01....
- dbaupp 8y agoThat sounds more similar to Swift's approach, where the compiler does aggressive optimisation to elide reference counts were possible. Do you agree?
- 8y ago
- Aardappel 7y agoMore on the compile time reference counting here: http://aardappel.github.io/lobster/memory_management.html http://aardappel.github.io/lobster/memory_management.html