But using the BumpVector makes the code cleaner too right ? and also the memory sanitizers will not show any more leaks as they are going to be freed. Another possiblity would be to resize the BumpVector by the size of references we need completely(by counting the number of relocation records). http://reviews.llvm.org/D6518