std.container update
Pillsy
pillsbury at gmail.com
Thu May 27 09:01:00 PDT 2010
== Quote from Andrei Alexandrescu
(SeeWebsiteForEmail at erdani.org)'s article:
> I just implemented a singly-linked list type to illustrate
> the container abstraction.
> http://erdani.com/d/phobos/std_container.html
> http://erdani.com/d/phobos/container.d
[...]
> 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?
Cheers,
Pillsy
More information about the Digitalmars-d
mailing list