Classes on stack

rikki cattermole rikki at cattermole.co.nz
Thu Sep 1 10:21:32 UTC 2022


On 01/09/2022 10:13 PM, Redwan wrote:
> if it's for GC, how to completely disable gc? I don't Wan use it at all. 
> I searched for a compiler command line disabling for gc but not found. 
> GC.disable() is ugly way I think.

As long as you want to use things like classes and Phobos, you're stuck 
with the GC being linked in and active at some point in the lifetime of 
your process.

D's runtime includes a lot of infrastructure such as threading that is 
initialized before your main ever executes.

You can limit the GC activity by things like GC.disable, but its still 
linked in and in use at some point in time.

D's GC is your friend, if you don't allocate it won't attempt to collect 
unless you want it to.


More information about the Digitalmars-d mailing list