Comment by pjmlp

3 years ago

And since no implementation has ever supported it, it has been deprecated in ISO Ada 95 and further removed from it on ISO Ada 2012.

https://en.wikibooks.org/wiki/Ada_Programming/Pragmas/Contro...

There was this project though.

https://github.com/Roldak/AGC

The best part is that it's faster than manual management. People will tell you they need do to malloc and free manually for performance, but when you actually run the numbers GC wins for a majority of use cases.

  • Tracing garbage collectors don’t generally win against reference counting connectors, especially when those reference counts are automatically elided via ARC (eg swift and objective C) or because they’re rarely used by means of composition (c++ and rust). Additionally, different kinds of application strategies are better depending on the use case (eg a pool allocator that you bulk drop at the end of some computation).

    What papers are you referencing showing tracing GCs outperforming things? If it’s just the website, I think it’s an artifact of a micro benchmark rather than something that holds true for non trivial programs.

    • I've always heard of the "Swift elides reference counts" statements but I've never seen it substantiated. I don't claim to be a Swift GC expert by any means, but the impression I get from the two Swift GC papers I've read [1, 2] is that Swift has a very simple implementation of RC. The RC optimization document (albeit the document is incomplete) [3] also doesn't give me the impression that Swift is doing much eliding of reference counts (I'm sure it is doing it for simple cases).

      Do you have any links which might explain what kind of eliding Swift is doing?

      EDIT: The major RC optimizations I have seen which elide references are deferral and coalescing and I'm fairly certain that Swift is doing neither.

      [1]: https://dl.acm.org/doi/abs/10.1145/3170472.3133843

      [2]: https://doi.org/10.1145/3243176.3243195

      [3]: https://github.com/apple/swift/blob/main/docs/ARCOptimizatio...

      7 replies →

    • The conventional wisdom is that evacuating (copying) GC's win over malloc/free since 1) the GC touches only the live data and not the garbage, and 2) it compacts the active memory periodically, which improves its cache and (when relevant) paging hit rates.

      Obviously though, this will be situation dependent.

    • Then why do every performant managed language opts for tracing GCs when they can?

      RC is used in lower level languages because it doesn’t require runtime support, and can be implemented as a library.

      As I wrote in another comment, even with elisions, you are still trading off constant writes on the working thread for parallel work, and you even have to pay for synchronization in parallel contexts.

      27 replies →

> and further removed from it on ISO Ada 2012.

and in that precise moment Ada proved it had garbage collection all along

  • By that measure same applies to C++, as C++20 removed the GC API introduced in C++11.

There was an Ada implementation on the Lisp Machine, that might have been using GC.

  • As for .NET and JVM implementations, but that is a consequence of underlying platform, just like C++/CLI and C++/CX, and none of them have been that big into the Ada compiler market.