Apparent problem with GC not collecting on Windows

Dmitry Olshansky dmitry.olsh at gmail.com
Sat Dec 1 11:49:36 PST 2012


12/1/2012 10:46 PM, thedeemon пишет:
> On Saturday, 1 December 2012 at 12:55:19 UTC, Dmitry Olshansky wrote:
>> It should help because:
>> 1) Each allocation happens in a new stack frame thus the pointer is
>> overwritten each time.
>
> To probably the same stinky value (a false pointer).

Pointer is different every time. So the initial pointer itself is 
overwritten. Everything else depends on luck. Some other values up the 
stack might still "point" to the block.

>> 2) Precise heap scanning helps this case because it greatly reduces
>> the amount of false pointers (note it's not the stack variables that
>> hold these allocations in place)
>
> I'm pretty sure in this case the false pointers are indeed in stack or
> data segment, not in the heap. Data arrays must be allocated with
> NO_SCAN flag so they're not scanned for pointers.

I've meant the actual array variable. Basically it's some other data 
that looks like a pointer to it elsewhere. Depending on how much runtime 
does dynamically allocate vs statically it may be the case that it is 
not in heap but in data segment. Or the used length of stack that should 
be quite small here.

Bottom line is that the bigger array you have the greater chance it 
won't be collected (because it's a nice target for random values in 
stack/data segment/heap). The more precise the scanner the better are 
chances of it being collected.


-- 
Dmitry Olshansky


More information about the Digitalmars-d-learn mailing list