Drawbacks of exceptions being globally allocated

Tejas notrealemail at gmail.com
Sun Aug 15 02:00:02 UTC 2021


On Saturday, 14 August 2021 at 23:14:51 UTC, Paul Backus wrote:
> On Saturday, 14 August 2021 at 15:58:17 UTC, Tejas wrote:
>> If you're willing to help further, would you please tell me 
>> why there is a GC allocation in the code below that uses 
>> ```emplace```? Will such code truly work if GC is never linked 
>> in the program?
>
> https://run.dlang.io/is/XEc2WJ
>
> ```
> onlineapp.d(26): Error: `@nogc` function `D main` cannot call 
> non- at nogc function `core.memory.GC.stats`
> ```
>
> Looks like `GC.stats` uses the GC.

Then why is it (0,0,0) the first time it gets used?

I actually stole this from 
[here](https://github.com/dlang/dmd/pull/8508#issuecomment-538310708) and assumed the author knew what he was doing.

FWIW, using ```DRT-gcopt=verbose:2``` gives grand total GC time 
as 0 so maybe there is something up with ```GC.stats``` only.


More information about the Digitalmars-d-learn mailing list