Why are binaries/executables so large on Windows?

Sean Kelly sean at f4.ca
Tue Jul 24 09:18:07 PDT 2007


Stewart Gordon wrote:
> "Jarrett Billingsley" <kb3ctd2 at yahoo.com> wrote in message 
> news:f7r6fp$1ahq$1 at digitalmars.com...
> <snip>
>> This 70KB is largely due to the runtime type info which is included 
>> (and necessary) for most of the runtime to use.
> 
> Most of the runtime?  Why?  At the moment we have:
> - AAs
> - sorting
> - variadic functions
> 
> (Is RTTI basically just the TypeInfo classes in D?)

Yes.

> Of course, garbage collection could also use RTTI, but does the current 
> GC implementation use it?

In a way.  The runtime pulls certain information from TypeInfo to tell 
the GC whether blocks it allocates contain pointers.

> Moreover, ISTM that even if the runtime does need RTTI, I'd think the 
> average program wouldn't need it for every single type in the language, 
> the program and any library it uses.  There ought to be a way to 
> optimise by linking in the RTTI for only those types where it's actually 
> needed.

I think the problem here is file-level linking.  To get around this with 
the current linker you'd need to generate a separate file for every 
TypeInfo used by the app, and then only link the ones that are actually 
used.  Section-level linking would be much easier to accomplish.

>> This also includes the garbage collector.
> <snip>
> 
> What does - the 70KB, RTTI or "most of the runtime"?

For a "hello world" application, the 70k is mostly runtime code rather 
than TypeInfo.  The runtime itself doesn't contain many objects, so it 
doesn't generate a lot of TypeInfo all by itself.


Sean



More information about the Digitalmars-d mailing list