Want reasonable reference counting? Disable automatic sharing of immutable
Elronnd
elronnd at elronnd.net
Tue Nov 16 19:39:02 UTC 2021
On Tuesday, 16 November 2021 at 17:52:10 UTC, Andrei Alexandrescu
wrote:
> At least in theory it could mark pages as read-only. Current
> compilers do that for statically-initialized constant data, but
> not for anything else.
Would require annoying bookkeeping for small allocations.
Obvious route is on every allocation you unprotect/reprotect;
that's slow. Alternately you can make one rw mapping and one ro
mapping; write the newly created data through rw space, but
return a pointer to ro space. But then you are technically not
'immutable'.
More information about the Digitalmars-d
mailing list