We are using Clang, and I've noticed that for large projects, storing all
Translation Units in memory can consume a large amount of RAM (e.g. for 20 *
400KB source files => 20 TUs of 380 MB RAM). We also cache much information
from the TU, so this significantly increases RAM usage.
What is the recommendation in such a case (specifically with clang 2.9 but
also with 3.x)? Storing each TUs on disk can take up to 140ms to serialize
each TU and 6.5 MB of disk space for each TU. The problem with this approach
is that once you save a TU on disk and you de-serialize it back again into
memory, the old CXCursors are no longer valid. There also doesn't seem to be
a way of specifying a flag to clang_parsetranslationunit, so that the TU
will be significantly smaller.
Any suggestion is welcome,