[libcxx-commits] [libcxx] [ASan][libc++] Optimize `__annotate_delete` for the default allocator (PR #76176)
via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Dec 22 15:10:50 PST 2023
AdvenamTacet wrote:
When a container's buffer contains N bytes, a pessimistic estimation is that N/8 bytes will be written into shadow memory. In the worst-case scenario, this can double the run-time of ASan operations during deallocation. If the buffer is large and there are many deallocations, this performance impact could be noticeable.
While the performance gain is small in the grand scheme of things, it is still a gain that we are leaving on the table. However, if you believe that adding an additional line with an if statement in an ASan helper functions is too high a price to pay for that performance gain, I understand, but disagree.
Real values depend on the container and its state.
For vector, that may be accurate estimation instead of a pessimistic one, due to [a clear just before destruction](https://github.com/llvm/llvm-project/blob/main/libcxx/include/vector#L490-L491).
https://github.com/llvm/llvm-project/pull/76176
More information about the libcxx-commits
mailing list