std.allocator needs your help
Rainer Schuetze
r.sagitario at gmx.de
Tue Sep 24 14:34:36 PDT 2013
On 24.09.2013 23:05, Andrei Alexandrescu wrote:
>> Taking the current array implementation as an example, the deltas are
>> computed before the actual GC lock happens inside gc_extend which means
>> that the second of two concurrent requests leads to overallocation.
>
> (I'm confused - which array implementation?)
I mean the dynamic array implementation in rt.lifetime.
> Does this qualify as an
> implementation bug, or are you referring to the case where the void[]
> being reallocated is being shared?
Yes, I'm referring to a shared void[], e.g. strings which use immutable
shared buffers that you can still append to if you are not stomping
other data.
Appending to it does not need a lock for the whole operation, but only
an atomic operation when adding to the stored size (though the
implementation uses a synchronized block to change the size).
More information about the Digitalmars-d
mailing list