A better way to check if the gc is running

rikki cattermole rikki at cattermole.co.nz
Mon Dec 16 13:34:38 UTC 2019


On 17/12/2019 2:23 AM, Bogdan Szabo wrote:
> On Sunday, 15 December 2019 at 22:33:58 UTC, Steven Schveighoffer wrote:
>> On Thursday, 12 December 2019 at 09:00:38 UTC, Petar Kirov 
>> [ZombineDev] wrote:
>>> On Thursday, 12 December 2019 at 08:56:37 UTC, bogdan wrote:
>>>> Hi,
>>>>
>>>> When combining ref counting and GC allocated classes, weird bugs 
>>>> might happen. Is it possible to add a new member in 
>>>> `core.memory.GC`, like `isCollecting` or `isRunning`, to avoid 
>>>> testing if the GC is running, without allocating like this?
>>>>
>>>> https://p0nce.github.io/d-idioms/#GC-proof-resource-class
>>>>
>>>>
>>>
>>> I agree that this is a good idea. It shouldn't be hard to implement 
>>> as the GC implementation already has this information available, so 
>>> it's just a matter of exposing it through the layers.
>>
>> https://issues.dlang.org/show_bug.cgi?id=17563
>>
>> -Steve
> 
> This looks like an old issue, maybe we won't have this very soon... Is a 
> DIP necessary for such changes?

Only if it requires language changes (like adding a parameter to the 
destructor).


More information about the Digitalmars-d mailing list