Review Request: Patch to reduce C++ parser memory consumption by removing parent AST pointer from AST nodes

Alexander Dymo alexander.dymo at
Mon Feb 15 14:04:31 UTC 2010

This is an automatically generated e-mail. To reply, visit:

Review request for KDevelop, Bertjan Broeksema and David Nolden.


We currently have AST *parent pointer in every AST node and it's never used in our code (I mean the release-ready code). Bertjan, I know that's something you wanted for your work, but maybe you can implement another way of storing parents (a map perhaps?). This unused pointer increases the size of AST and I'd like to avoid things like that as much as possible.

For my large C file, the peak memory consumption is reduced from 703M to 655M (-48M) by removing the parent pointer.


  /trunk/extragear/sdk/kdevelop/languages/cpp/cppparsejob.cpp 1090158 
  /trunk/extragear/sdk/kdevelop/languages/cpp/parser/CMakeLists.txt 1090158 
  /trunk/extragear/sdk/kdevelop/languages/cpp/parser/parentvisitor.h 1090158 
  /trunk/extragear/sdk/kdevelop/languages/cpp/parser/parentvisitor.cpp 1090158 
  /trunk/extragear/sdk/kdevelop/languages/cpp/parser/parsesession.h 1090158 
  /trunk/extragear/sdk/kdevelop/languages/cpp/parser/parsesession.cpp 1090158 



All tests pass.



More information about the KDevelop-devel mailing list