3 ms·
How does it collect cyclic data structures with consistent latency?
by chrisseaton 8y ago
How does it collect cyclic data structures with consistent latency?
- mpweiher 8y agoWith programmer support and weak references.
- chrisseaton 8y agoWell it’s easy to make a GC with consistent latency if your attitude is ‘don’t collect things that need inconsistent latency to collect.’
- fpoling 8y agoWith a good architecture and right tools to detect cycles due to bugs the reference counting works even for complex applications. Essentially this is a trade off between development time versus headache at deployment.
- mpweiher 8y agoIt's not a GC (in the now common vernacular). Easy is good, particularly if it works well. Which it does. Also much more frugal with memory than typical tracing GCs.
- abalone 8y agoI doubt cyclical references are the only cause of inconsistent latency in mark and sweep.
- chrisseaton 8y agoThey aren’t in mark and sweep but they are in reference counting.
- ghusbands 8y agoThere exist runtimes that use reference counting and mark/sweep together. Mark/sweep is used to collect cycles that reference counting misses. PHP and Firefox's XPCOM both turn up in a google search for Cycle Collector. Maybe Swift will gain it, one day.
- chrisseaton 8y agoAll serious GCs end up being a combination of reference counting and tracing, given enough time.
- abalone 8y ago> Maybe Swift will gain it, one day. Maybe not. “We have discussed in the passed using hybrid approaches like introducing a cycle collector, which runs less frequently than a GC would. The problem with this is that if you introduce a cycle collector, code will start depending on it. In time you end up with some libraries/packages that works without GC, and others that leak without it (the D community has relevant experience here). As such, we have come to think that adding a cycle collector would be bad for the Swift community in the large.”[1] [1] https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160208/009422.html https://lists.swift.org/pipermail/swift-evolution/Week-of-Mo...