A better way to check if the gc is running
Petar
Petar
Thu Dec 12 09:00:38 UTC 2019
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
>
>
> Thanks,
> Bogdan
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.
More information about the Digitalmars-d
mailing list