On heap segregation, GC optimization and @nogc relaxing
deadalnix via Digitalmars-d
digitalmars-d at puremagic.com
Thu Nov 13 14:15:36 PST 2014
On Thursday, 13 November 2014 at 14:26:44 UTC, Marc Schütz wrote:
> The important part is that owning, RC and GC types all need to
> know the allocators they belong to. In my example I need that
> to allow Owned types to be converted to RC types. In your
> proposal, something similar will ultimately be needed for
> merging the islands into specific heaps. The nice thing is that
> this scheme also allows for switching allocators on the fly at
> runtime, without template bloat, at the cost of virtual calls
> for using the allocators (which is probably an acceptable
> compromise for an inherently expensive thing like allocation).
If you have a owned type, you don't need a builtin RC type. As
long as the wrapper that implement the RC own the RCed object,
everything is safe.
Also, this construct as the nice side effect that a single
reference count can own a whole island instead of tracking all
objects RC one by one.
More information about the Digitalmars-d
mailing list