3 ms·
Looks like a good tutorial, but it doesn't go into much depth on memory-management. The More About Types section has a little. It mentions that automated refere
by MaxBarraclough 6y ago
Looks like a good tutorial, but it doesn't go into much depth on memory-management. The More About Types section has a little. It mentions that automated reference-counting is available through the GNATCOLL library, which seems to have since been broken apart into three different packages [0], so it now resides in gnatcoll-core [1].
Can anyone comment on memory-management in Ada?
[0] https://github.com/AdaCore/gnatcoll https://github.com/AdaCore/gnatcoll
[1] https://github.com/AdaCore/gnatcoll-core/blob/master/src/gnatcoll-refcount.ads https://github.com/AdaCore/gnatcoll-core/blob/master/src/gna...
- Raphael_Amiard 6y agoHello Max! We agree that it's a hole in the current curriculum, that we intend to fill at some stage with the advanced lessons. State of memory management in Ada is: - You have a lot of facilities to stack allocate/not heap allocate tons of stuff that you would heap allocate in pretty much any other low level languages. - When that doesn't cover you, in Ada you're basically at the level of C++: You have refcounted pointers, unique pointers (which are enforced via limited types) in GNATCOLL, managed containers in the stdlib, and manual memory management. You have storage pools which, with the 2012 additions, are roughly similar to custom allocators in C++/Rust. - In SPARK we have ownership pointer that are roughly similar to pointers in Rust: https://blog.adacore.com/using-pointers-in-spark https://blog.adacore.com/using-pointers-in-spark Anecdotally, I have a friend/colleague working on a fun side project, https://github.com/Roldak/AGC https://github.com/Roldak/AGC, meant to plug a garbage collector into Ada, since the language is much more amenable to that than C or C++. (completely prototype/for fun project, hence why I'm not including it in the "serious" options at your disposal above)
- MaxBarraclough 6y agoGreat answer, thanks.
- pjmlp 6y agoBesides the sibling comment, there is a FOSDEM talk about it. https://archive.fosdem.org/2016/schedule/event/ada_memory/ https://archive.fosdem.org/2016/schedule/event/ada_memory/