Want reasonable reference counting? Disable automatic sharing of immutable

IGotD- nise at nise.com
Tue Nov 30 20:49:52 UTC 2021


On Tuesday, 16 November 2021 at 19:39:02 UTC, Elronnd wrote:
>
> 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'.

I'll give you a hint: Don't do many small allocations. There is 
an overhead regardless of RC or not.




More information about the Digitalmars-d mailing list