static void arrays under garbage control?

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Feb 25 17:24:09 PST 2015


On Thursday, 26 February 2015 at 01:15:37 UTC, captaindet wrote:
> pointers to static data."

Keep in mind that this is pointers TO static data - that is, if 
the object itself is static, it is not to be collected.

static int[5] foo = [1,2,3,4,5]; // foo will never be collected, 
even if there are no pointers to it


But, the static array itself will be scanned:

static Object[2] objects;

The objects stored in there won't be garbage collected because 
this array is still scanned.


So

> does this warning only apply to dynamic void[] arrays but not 
> to static void[CTconstant] arrays?

Both of those will be scanned for pointers.


More information about the Digitalmars-d-learn mailing list