Construction of InternalMmapVector is often followed by a call to reserve(), which may result in immediate reallocation of the memory for the internal storage. This patch delays that allocation until it is really needed.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
I'd like to note that this is not a purely theoretical issue. It can be observed, for example, in Symbolizer::ModuleNameOwner on a 64-bit platform with 4K memory pages. The default constructor for storage_ allocates one memory page, which is immediately replaced by a new allocation in the call to reserve() for 1000 elements, which requires 8 * 1000 = 8000 bytes, or two pages.