How to stop DMD from exploding the executable file size?

max haughton maxhaton at gmail.com
Fri Sep 2 17:53:51 UTC 2022


On Tuesday, 30 August 2022 at 22:51:46 UTC, ryuukk_ wrote:
> Having this simple code makes the executable gigantic!
>
> ```D
> struct Big
> {
>     int[1024 * 1024] big = 0;
> }
>
> Big big;
> ```
>
> Only with DMD, LDC produces a tiny executable
>
> Is there a flag available to fix this behavior? it's not 
> sustainable

You really shouldn't have structs this big unless absolutely 
necessary.

The thing being elided is the initializer and pointer bitmap for 
the runtime to use.


More information about the Digitalmars-d mailing list