From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: silly ravenscar question Date: Tue, 24 Feb 2015 13:58:34 +0000 Organization: A noiseless patient Spider Message-ID: References: <8e30f54c-81c4-4861-897c-bb6c563c76e8@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="e618d14f82e68d7a5374d9f6ab6c203f"; logging-data="8839"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18DMevmj41OhDa7lCWtmo7EFX23c4v36m4=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (darwin) Cancel-Lock: sha1:fn1nggiD/EEwPiV8e6B0ZtcoNHo= sha1:rPk0YCNVF0alpfCZmEx484ChkXY= Xref: news.eternal-september.org comp.lang.ada:25015 Date: 2015-02-24T13:58:34+00:00 List-Id: jan.de.kruyf@gmail.com writes: > Doing a variable length linked list on Gnat for Arm I found I can do > > object_access := new object; > > but I can not free this object. I follow that dynamic memory > allocation is something bad (tm), under certain circumstances. But > now since 'new' seems to be allowed, does it work properly at all > times? I mean I could link any freed objects into a free list for > later use. That does not cost much, probably less than allocating by > way of 'new'. GNAT allocates & frees memory via System.Memory. The AdaCore Ravenscar profile's version says -- This is a simplified version of this package, for use with a configurable -- run-time library that does not provide Ada tasking. It does not provide -- any deallocation routine. The spec doesn't contain a Free (the body contains a null version). I haven't worked on such a system, but I understand that systems that require restricted runtimes often either forbid dynamic allocation altogether or insist that all allocations take place during startup.