Lazy and GC Allocations

Etienne etcimon at gmail.com
Mon Feb 20 00:50:58 UTC 2023


Hello,

I'm wondering at which moment the following would make an 
allocation of the scope variables on the GC. Should I assume that 
the second parameter of enforce being lazy, we would get a 
delegate/literal that saves the current scope on the GC even if 
it's not needed? I'm asking purely for a performance perspective 
of avoiding GC allocations.

```
void main() {
  int a = 5;
  enforce(true, format("a: %d", a));
}
```

Thanks

Etienne


More information about the Digitalmars-d-learn mailing list