Program size, linking matter, and static this()
Marco Leise
Marco.Leise at gmx.de
Wed Jan 18 01:43:26 PST 2012
Am 27.12.2011, 03:42 Uhr, schrieb Marco Leise <Marco.Leise at gmx.de>:
> Am 21.12.2011, 07:11 Uhr, schrieb Walter Bright
> <newshound2 at digitalmars.com>:
>
>> On 12/20/2011 5:52 PM, Marco Leise wrote:
>>> 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?
>>
>> The struct one already does. Compile it, obj2asm it, and you'll see it
>> there.
>
> Ah, I see it now. Sorry for the noise!
It is back again! The following struct in my main module increases the
executable size by 10MB with DMD 2.075:
struct Test {
byte abcd[10 * 1024 * 1024];
}
It seems not to do so with *both* of these declarations, that create
static arrays in the module:
byte abcd[10 * 1024 * 1024];
__gshared byte abcd[10 * 1024 * 1024];
More information about the Digitalmars-d
mailing list