[PATCH] D119177: [demangler] Fix buffer growth
Nathan Sidwell via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 9 08:36:33 PST 2022
urnathan added inline comments.
================
Comment at: libcxxabi/src/demangle/Utility.h:42
+ if (Need > BufferCapacity) {
+ if (!BufferCapacity && Need < 100)
+ // Avoid many reallocations during startup
----------------
ChuanqiXu wrote:
> What's the meaning of the magic number 100? Generally we should make it configurable or at least we should give a name to it.
It seems dramatically over-engineering to make this configurable. You just want a number high enough for many symbols in one go, and big enough that larger symbols don't keep reallocating. But not so big that one allocates a tremendously excessive amount. The demangler Nodes themselves are probably the largest component?
100 seemed a good enough value. It's better than the current [non-configurable] zero :) I notice the demangler's node allocator (BumpPointerAllocator) allocates [unconfigurable] 4096 byte blocks. So let's go with 1024 here, ok?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119177/new/
https://reviews.llvm.org/D119177
More information about the llvm-commits
mailing list