std.container update

Pillsy pillsbury at
Thu May 27 09:01:00 PDT 2010

== Quote from Andrei Alexandrescu
(SeeWebsiteForEmail at's article:
> I just implemented a singly-linked list type to illustrate
> the container abstraction.
> Please let me know of how you find it.

One thing worries me a bit, but may be based on a misunderstanding
of how D's GC works. In dup, you allocate all the nodes at once as
an array and then go through them one by one setting their payload_
and next_ values to make the list.

My worry is that the array is allocated as a single block and
(presumably) GC'd as a single block. If I copy a 1000 element list
and then remove 999 elements from the front using removeFront(),
won't I end up leaking memory for the first 999 nodes?


More information about the Digitalmars-d mailing list