Program size, linking matter, and static this()

Marco Leise Marco.Leise at gmx.de
Tue Dec 20 17:52:41 PST 2011


Am 20.12.2011, 22:39 Uhr, schrieb Walter Bright  
<newshound2 at digitalmars.com>:

> On 12/20/2011 1:07 PM, Marco Leise wrote:
>> +1. I didn't know about .bss, but static arrays of zeroes (global,  
>> struct,
>> class) increasing the executable size looked like a problem wanting a  
>> solution.
>> I hope it is easy to solve for dmd and is just an unimportant issue, so  
>> was
>> never implemented.
>
> I added a faq entry for this.

Ok, I jumped on the band wagon to early. Personally I only had this  
problem with classes and structs.

struct Test {
	byte arr[1024 * 1024 *10];
}

and

class Test {
	byte arr[1024 * 1024 *10];
}

both create a 10MB executable. While for the class, init may contain more  
data than just that one field, I don't see the struct adding anything or  
going into TLS. Can these initializers also go into .bss?


More information about the Digitalmars-d mailing list