[cfe-commits] r101194 - /cfe/trunk/include/clang/AST/ASTVector.h

Benjamin Kramer benny.kra at googlemail.com
Wed Apr 14 04:59:03 PDT 2010

On 14.04.2010, at 01:39, Ted Kremenek wrote:

> Author: kremenek
> Date: Tue Apr 13 18:39:09 2010
> New Revision: 101194
> URL: http://llvm.org/viewvc/llvm-project?rev=101194&view=rev
> Log:
> Introduce ASTVector, which is a std::vector-like class that allocates all memory
> using the allocator associated with an ASTContext.  This is largely copy-and-paste
> from SmallVector, and should be refactored one day.

I was thinking about this before and came to the conclusion that a BumpPtrAllocator + vector is a
bad combination. Every time the vector resizes the old memory isn't freed and adds up. I guess
it doesn't matter in smaller cases but it could become a huge memory waste if we're not checking every
ASTVector's insert characteristics carefully. In my opinion a list-like data structure should be
preferred (where applicable).

More information about the cfe-commits mailing list