Wednesday, June 15, 2005

Executable sizes

I have a simple application built with Nitrogen. It's called "DragPeeker X", which replaces the venerable Apple application DragPeeker, which was distributed with the "Drag and Drop Toolkit" in 1994, when the Drag Manager was new.

I got it building and running using Xcode, and it seems to work just fine.

However, I did a "Get Info" on the new app, and I was shocked - the application was about 3.2 MB in size! I went back and looked at the CodeWarrior executable, and it was about 600KB - much more reasonable. (But still too big for what it does)

I'm using gcc4, so that I am linking against the libstdc++.dylib, so the app should be smaller than before, right? (Since I don't have to carry around a copy of the C++ standard library).

So, what's going on here?
A little digging around shows lots of differences, but the big difference is the "LINKEDIT" section of the Mach-O binary. The CW binary has a section size of about 400K, but the Xcode LINKEDIT section is 2.6 MB!

In both cases the LINKEDIT section dwarfs the code actually in the application, but I don't know why the Xcode one is so much bigger (maybe it _is_ because of libstdc++.dylib)


Post a Comment

<< Home