New libclang API: clang_suspendTranslationUnit to reduce memory footprint

Kevin Funk kfunk at
Wed Jun 7 06:43:59 UTC 2017


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 

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!

Kevin Funk | kfunk at |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 163 bytes
Desc: This is a digitally signed message part.
URL: <>

More information about the KDevelop-devel mailing list