Idea #1 on integrating RC with GC
Adam D. Ruppe
destructionator at gmail.com
Wed Feb 5 11:42:25 PST 2014
On Wednesday, 5 February 2014 at 19:36:00 UTC, Namespace wrote:
> static struct Payload {
> void* ptr;
> int* rc;
> }
>
> Payload* p;
Now there's double indirection to get to the data... and you also
forgot the necessary postblits and dtors to maintain the
reference count. (these could be inlined or elided in some cases,
but not all)
You can't put the rc at the beginning of the pointer either,
since then a = a[1..$] won't work. So the added pointer is
unavoidable, your way or my way, both have a cost.
More information about the Digitalmars-d
mailing list