
Memory Management with Ada 2012 - pjmlp
https://fosdem.org/2016/schedule/event/ada_memory/
======
kazinator
> _" 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.

~~~
pjmlp
I 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
Let'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.

------
nickpsecurity
Ill check ig out later. Found this updated paper that covers its safety techs:

[http://www.adacore.com/uploads/technical-
papers/SafeSecureAd...](http://www.adacore.com/uploads/technical-
papers/SafeSecureAdav2015-covered.pdf)

Edit: A quick skim showed the paper was quite thorough with lots of code
examples.

