December 01, 2012
On Friday, 30 November 2012 at 18:46:08 UTC, Dmitry Olshansky wrote:

> I'd just throw in that we have a (almost) precise GC that is used by  at least one large project (the VisualD apparently). Though there were some problems with it. Anyway I'd expect to see it in upstream by 2.062 at least. It should help the cases like this tremendously.

I expect it wouldn't help in this particular case because stack scanning is still conservative there (correct me if I'm wrong), and here we've got some stack value looking like a pointer to the array.

December 01, 2012
12/1/2012 2:53 PM, thedeemon пишет:
> On Friday, 30 November 2012 at 18:46:08 UTC, Dmitry Olshansky wrote:
>
>> I'd just throw in that we have a (almost) precise GC that is used by
>> at least one large project (the VisualD apparently). Though there were
>> some problems with it. Anyway I'd expect to see it in upstream by
>> 2.062 at least. It should help the cases like this tremendously.
>
> I expect it wouldn't help in this particular case because stack scanning
> is still conservative there (correct me if I'm wrong), and here we've
> got some stack value looking like a pointer to the array.
>

It should help because:
1) Each allocation happens in a new stack frame thus the pointer is overwritten each time.
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)

It doesn't guarantee that it will collect all of these chunks but number of false pointers that could point to them is far lower and the chance of being collected is that much higher.

The stack is typically small, unlike the heap.

-- 
Dmitry Olshansky
December 01, 2012
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).

> 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.
December 01, 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
Next ›   Last »
1 2
Top | Discussion index | About this forum | D home