A better way to check if the gc is running

Steven Schveighoffer schveiguy at gmail.com
Mon Dec 16 17:14:36 UTC 2019


On 12/16/19 8: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
>>
> 
> This looks like an old issue, maybe we won't have this very soon... Is a 
> DIP necessary for such changes?

No. It's completely a library change, and backwards compatible.

-Steve


More information about the Digitalmars-d mailing list