5 ms·
> "and garbage collection is just a way to overcome the lack of proper memory management in many languages. " In many others, however, GC isn't simply a band-a
by kazinator 11y ago
> "and garbage collection is just a way to overcome the lack of proper memory management in many languages. "
In many others, however, GC isn't simply a band-aid for hunting down leaks; the semantics of what is going on in a typical program written in those languages makes it intractable for the program itself to compute the correct lifetime of every object, and GC is built into the design of the language from the beginning.
Not all entities which occupy storage are always reified as explicit objects that can be disposed. For example, lexical variable binding environments usually do not themselves appear as values anywhere in the program. They become heap allocated objects if captured in closures. Closures themselves are visible values, but disposing a closure doesn't mean that its environment can be disposed, since multiple closures can capture the same environment. Moreover, an environment can lead to a circular reference back to a closure which captures that environment, so refcounting isn't a proper solution.
- groovy2shoes 11y agoAdditionally, dealing with persistent data structures without GC can be very tricky.
- toolslive 11y agomoreover, lock free data structures become easier when you have a garbage collector.
- nickpsecurity 11y agoWhy is that?
- pjmlp 11y agoI like Ada a lot, but I agree with you here, the guy had a bit anti-GC bias. Actually I feel Modula-3 had a better approach to systems programming, but unfortunately it died when DEC Olivetti went down. It is very hard to overcome anti-GC bias to anyone that never used GC enabled languages in systems programming like Modula-3 or Oberon and its derivatives. Or the interesting outcomes from Singularity and Midori projects. Nowadays the proper alternative to GC is probably a mix of dataflow and affine type systems, but they have yet to gain wider acceptance. However in Ada's defense, it does allow a lot of automatic memory management RAII style as described in the presentation, but it does require more effort than the alternatives.
- nickpsecurity 11y agoLet's not forget two other possibilities: a mix of static analysis with concurrent GC to automatically collect known-safe frees; HW support for concurrent GC a la Azul's Vega 3 that makes it free. I hot the former idea from CompSci work doing that to reduce safety checks in compilers that auto-transform code. Not sure if it's been applied to GC's. The latter was proven several times over and could supplement the former. The latter is more feasible now that semi-custom CPU's are a big business.