Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Huge OBJ files in VS2008 C++ compilation compared with VS6

We have a large project, >1M lines of code in about 300 DLLs. So far we've been using VS6.

I've now converted everything to VS2008, all compiles, links and more importantly - runs!

==>However... the resulting compiled OBJ files are X 10 bigger and linking is extremely slow, with the linker hitting >1GB of memory quite often.

Part of the implications are that I need to compile certain prjects with /bigobj.

Result is a build that went from about 1:45 on a desktop to 3h. The DLLs and the LIBs are roughly the same size as in the old VS6 build.

I've read all I could find here but didn't find a remedy to this problem. If it is additional DEBUG info - I don't want it. I had enough before. The size in release increased, but not so much...

Anyone has any idea? Or is my only option to break down the projects into much smaller units? Is refactoring my only hope?! Surely there's a secret flag I missed...


Edit1 (13/07/2012 12:20BST) I've compared dumpbin of an Obj created by VS6 vs. VS2008. The one in 2008 appears as if "staticly linking". In VS6 it contains a few symbols all from the current DLL. In VS2008 it contains symbols from (probably) all libraries it is dependent upon. Dumpbin sizes are 66kb and 32,000kb for VS6 and VS2008, respectively.
like image 642
aabramovich Avatar asked Jul 12 '12 17:07

aabramovich


1 Answers

Check your debugging options. /Z7 causes large .OBJ files, /Zi puts the same information in a separate .PDB file.

Compiler option /Oi may help by inlining intrinsic function, which then no longer need to be linked. You probably don't want to debug memset anyway.

Turn off /Gm (incremental rebuild) so you can turn on /MP (parallel build). Also turn off /Gy - while it makes for smaller EXE's, it causes bigger OBJ files and slower linking.

like image 82
MSalters Avatar answered Nov 16 '22 03:11

MSalters