Escaping the Tyranny of the GC: std.rcstring, first blood

Rainer Schuetze via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 15 08:58:17 PDT 2014



On 15.09.2014 07:49, Andrei Alexandrescu wrote:
>> I haven't found a single lock, is single threading by design or is
>> thread-safety on your todo?
>
> Currently shared strings are not addressed.

Please also consider usage with const and immutable:

* both will disallow changing the reference count without casting

* immutable means implicitely shared between threads, so you'll have to 
make RCString thread-safe even if shared isn't explicitly supported.

Unfortunately, I've yet to see an efficient thread-safe implementation 
of reference counting (i.e. without locks).

VC used to have reference counted strings, but moved away from it. Maybe 
it doesn't pull its own weight in the face of the small-string-optimization.


More information about the Digitalmars-d mailing list