D array expansion and non-deterministic re-allocation

Steven Schveighoffer schveiguy at yahoo.com
Tue Nov 24 10:14:04 PST 2009


On Tue, 24 Nov 2009 12:46:37 -0500, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> Steven Schveighoffer wrote:
>> Lookup should be atomic without locking (I think, simply an integer  
>> load right?), but you'd have to lock to actually do an append.
>>  I don't think we solve the lock problem without having multiple  
>> heaps...
>
> I don't think we need to worry about optimizing growth of shared arrays.

This doesn't compute.  The heap is shared, you need to store the allocated  
length in the heap, you need to lock on every allocate, even for  
non-shared arrays.  What am I missing?  Can you update *parts* of the heap  
without locking?  If so, why do we need an MRU cache?

-Steve



More information about the Digitalmars-d mailing list