[cfe-dev] Storing Translation Units In Memory For Large Projects

jaytee aloha_arts at yahoo.com
Tue Jul 31 06:42:30 PDT 2012


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,
Thank you!



--
View this message in context: http://clang-developers.42468.n3.nabble.com/Storing-Translation-Units-In-Memory-For-Large-Projects-tp4025853.html
Sent from the Clang Developers mailing list archive at Nabble.com.



More information about the cfe-dev mailing list