Why are void[] contents marked as having pointers?
Denis Koroskin
2korden at gmail.com
Sun May 31 12:54:30 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.
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.
It is a breaking change, but may be changed for D2. In 99% it is a correct behavior (and a bug in a rest), but reduces application execution speed significantly.
++vote
More information about the Digitalmars-d
mailing list