Question

I have downloaded a C++ library which is about 450 MB in size. After building, the library takes about 2 GB. Why such big difference ? Where did all the extra size go to ?

My question is more philosophical than technical. I don't seek an exact answer to my particular software issue, but rather a general explanation to why library sizes may differ across different build scenarios.

Was it helpful?

Solution

The one thing that may be in common across many software development languages and compilers is that a debug version of any library will be different to a release version.

A release version is typically built with size and performance in mind, and a release version is likely to be optimised, symbols might be stripped, and additional code, memory guards, debug helpers, et cetera, maybe removed from the source (e.g., in the C family, via means of pre-processor defines).

Note however, that this doesn't always imply that a chunk of release code will be smaller than its debug counterpart. For example, in the search for performance, speaking of the C family again, loops might be unrolled - resulting in code which is faster but larger.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top