Is Phobos's Garbage Collector utterly broken? (Phobos vs Tango)
Sean Kelly
sean at f4.ca
Wed Aug 1 08:25:02 PDT 2007
Deewiant wrote:
> Sean Kelly wrote:
>> Vladimir Panteleev wrote:
>>> Turns out it's still there, and it's the old "binary data" issue with
>>> pointer-searching GCs, which was fixed in D/Phobos 1.001 by making the
>>> GC type-aware. Check out the attached sample programs for a simple
>>> example - the Tango version can't know there are no pointers in its
>>> GrowBuffer's data, and thus leaks like crazy, while the Phobos version
>>> stays at 13MB.
>> It turns out this is because GrowBuffer uses a void[] internally to
>> store data. The type should probably be changed to byte[]. I'll file a
>> ticket for it.
>>
>
> Isn't this also a problem with all the IO stuff that use void[] for everything?
> It starts right up there at IBuffer and IConduit.
Well, passing data around as void[] is fine, it just can't be stored as
void[]. Buffer is one of the few objects that actually stores data in
this way.
> The way I see it: void[] is for "pure memory" that you might want to access in
> multiple different ways (akin to unions), ubyte[] is for the traditional model
> of "arbitrary data", and byte[] is just weird, I've yet to figure out a use for it.
That sounds like a good distinction. Feel free to add to the ticket if
you think other uses of void[] should be changed to byte[] or ubyte[].
Sean
More information about the Digitalmars-d
mailing list