Must not modify the_index.cache as it may be passed to realloc at some point.