bearophile wrote:
Note: this produces the same very large binary, I don't know why:
double[100_000] arr = void;
static this() {
arr[] = typeof(arr[0]).init;
}
void main() {}
obj2asm tells the tale. (obj2asm is an incredibly useful tool, I don't
know why nobody uses it.)
double[100_000] arr = void;
puts arr in the thread local storage segment. Unfortunately, there is no
bss for TLS.
__gshared double[100_000] arr = void;
puts arr in the BSS segment, which takes up space in your executable but
not the executable *file*.