Why are void[] contents marked as having pointers?
Denis Koroskin
2korden at gmail.com
Sun May 31 12:58:38 PDT 2009
On Sun, 31 May 2009 22:45:23 +0400, Vladimir Panteleev <thecybershadow at gmail.com> wrote:
> I just went through a ~15000-line project and replaced most occurrences
> of void[]. Now the project is an ugly mess of void[], ubyte[] and casts,
> but at least it doesn't leak memory like crazy any more.
>
> I don't know why it was decided to mark the contents of void[] as "might
> have pointers". It makes no sense!
>
FWIW, I also consider void[] as a storage for an arbitrary untyped binary data, and thus I believe GC shouldn't scan it.
Ignoring void[] arrays is a correct behavior in 99% of cases (and a bug in a rest), but improves application execution speed significantly.
While it is possible to prevent GC from scanning an arbitrary void[] array, there is no reasonable way to prevent it from scanning all arrays (without modifying GC code).
It is a breaking change, but not too late for D2.
++vote
More information about the Digitalmars-d
mailing list