Clean Executable

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 27 08:11:35 PDT 2017


On Tuesday, 27 June 2017 at 14:21:50 UTC, FoxyBrown wrote:
> Does Writeln even use the GC to display a single string?

Not if all goes well, but a good chunk of the library is loaded 
to handle various situations. It might call a GC function if 
there's no stdout.

Take a look at this:

http://thecybershadow.net/d/mapview/data/5952742b0b88b.html

There's a lot of functions loaded from the library for cases that 
are very rare... like error writing out hello world is actually 
detected and thrown as an exception. There's also things in for 
module initializers and class factories that you don't use, but 
it is intertwined enough that the linker isn't able to optimize 
it out.


In a larger program, you'd probably actually use this stuff so 
the cost would diminish, but for a small program it is a bit 
tangled at this level.


More information about the Digitalmars-d-learn mailing list