New libclang API: clang_suspendTranslationUnit to reduce memory footprint

Milian Wolff mail at
Wed Jun 7 08:30:44 UTC 2017

On Wednesday, June 7, 2017 8:43:59 AM CEST Kevin Funk wrote:
> Heya,
> Just as a personal note and for future reference: There's new libclang API
> we can potentially use to save some memory, introduced by our friends from
> TheQtCompany:
> Worth having a look at it once we find the time.
> This is the commit message of the patch I'm referring to:
> commit 91321d9884b7ce357cac1d128244d22dbe2a0cc7
> Author: Erik Verbruggen <erikjv at>
> Date:   Tue May 30 14:25:54 2017 +0000
>     [libclang] Allow to suspend a translation unit.
>     A suspended translation unit uses significantly less memory but on the
>     other side does not support any other calls than
>     clang_reparseTranslationUnit to resume it or
>     clang_disposeTranslationUnit to dispose it completely.
>     This helps IDEs to reduce the memory footprint. The data that is freed
>     by a call to clang_suspendTranslationUnit will be re-generated on the
>     next (re)parse anyway. Used with a preamble, this allows pretty fast
>     resumption of the translation unit for further use (compared to disposal
> of the translation unit and a parse from scratch).
>     Patch by Nikolai Kosjar!

Yes, this sounds excellent! Esp. compare to what I just wrote to Rene.

Milian Wolff
mail at

More information about the KDevelop-devel mailing list