Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Hi Geofft! Ada developer here. When I read and study the Ada reference manual for the 1995 standard I get the impression that the Ada language designers were not thinking of third-party garbage collection or reference counting as the primary way of achieving memory safety but they were thinking of arena pools/storage pools. When one defines an access-to-object type in the 1995 standard one can specify in which storage pool the allocated object ends up in. The Ada standard does not talk about Stack and heap but talks about Stack and Storage pools. I get the impression that the idea is for an Ada application to get a number of storage pools (with statically determined sizes?) and one can allocate objects inside of these and when one is finished with the objects in a pool one deallocates them all at once by emptying the pool and then one can reuse it again. More efficient and less-error-prone than deallocating each object separately. You are right in point number 2 that the door for garbage collection is open in the Ada standard. No Ada compiler vendor has implemented a GC but you are right about it being considered. The idea for arena pool/storage pool can also been seen in the Ada language (also 1995 standard) by being able to define an access-to-object type locally inside a function/subprogram and at the point of the access-to-object types existence some memory is heap allocated (the size of the allocated memory is specified by the access-to-object type definition) and when the access-to-object type goes out of scope the memory is deallocated (without the use of unchecked_deallocation)... so there should be a forth point on arena/storage pools on your list. And it may be more suited for "a (say) safe implementation of the DOM that can render real-world web pages while efficiently using memory on a general-purpose computer".

To use storage pools in Ada I would recommend Deepend (https://sourceforge.net/projects/deepend/). Deepend is a storage pool with subpool capabilities for Ada 2012, Ada 2005, and Ada 95. Memory allocations can be associated with subpools and subpools can be deallocated as a whole which provides a safer alternative than managing deletions of individual objects. It also is likely to be more deterministic and efficient than garbage collection.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: