My Long Term Vision for the D programming language
Elronnd
elronnd at elronnd.net
Thu Nov 25 20:41:07 UTC 2021
On Thursday, 25 November 2021 at 15:42:28 UTC, max haughton wrote:
> Moving an unbounded allocation to malloc and free is fine. LIFO
> is totally irrelevant.
>
> The point is avoiding putting pressure on the GC. If you want
> to be clever you can probably come up with some hybrid
> arrangement that tries to use the stack if it can or has a
> buffer somewhere.
LIFO is a useful property that you can take advantage of. Why
would you _want_ to allocate on the heap when you could allocate
on [some kind of] stack?
Re GC pressure, you get the same amount of pressure (amortized,
assuming bounded allocation size and call-stack depth) if you
allocate with the gc and then GC.free at the end of the scope.
More information about the Digitalmars-d
mailing list