back to arays
Unknown W. Brackets
unknown at simplemachines.org
Fri May 19 22:20:11 PDT 2006
Right, sorry if I was unclear.
When you resize an array, it makes a copy - it still doesn't move
anything. When I was talking about moving, I was meaning a compacting
(defragmenting) garbage collector.
DMD's garbage collector holds onto any pointer references which are
still active, even if you change the length of a dynamic array - so that
issue shouldn't affect this.
For slices to work properly, the above must be guaranteed afaik. But
holding onto the memory around said slices need not be guaranteed.
PS: I've been called a lot of different things (Uncle Brackets, Big U,
etc.), but I hadn't ever heard "W. Brackets". Heh.
-[Unknown]
> Derek Parnell wrote:
>> On Wed, 17 May 2006 22:07:12 -0700, Unknown W. Brackets wrote:
>>
>>> I should note, currently, DMD's implementation won't move anything
>>> you're pointing to.
>>
>> Even if the length is increased beyond the size that has been
>> allocated for
>> a dynamic array? I thought that DMD allocated a new block of the right
>> size
>> and copied data from the old block to it then released the old block back
>> to the GC.
>>
>
> Yes, that's what it does, but that resizing results from an explicit
> programmer action, and not from the GC. When W. Brackets mentioned
> "DMD's implementation" I believe he meant the GC only, which, as is
> known, indeed doesn't currently move anything.
More information about the Digitalmars-d-learn
mailing list