Disable TTempBuf per-thread cache with address sanitizer to detect overflows
@@ -132,7 +132,7 @@ namespace {
Unused_.ForEach(deleter);
}
- inline TPerThreadedBuf* Aquire() {
+ inline TPerThreadedBuf* Acquire() {
if (!Unused_.Empty()) {
return Unused_.PopFront();
}
@@ -154,6 +154,15 @@ static inline TTempBufManager* TempBufManager() {
return FastTlsSingletonWithPriority<TTempBufManager, 2>();
}
+static inline TTempBuf::TImpl* AcquireSmallBuffer(size_t size) {
+#if defined(_asan_enabled_)
+ return new (size) TAllocedBuf();
+#else
+ Y_UNUSED(size);
+ return TempBufManager()->Acquire();
+#endif
+}
+
void TPerThreadedBuf::Dispose() noexcept {
if (Manager_ == TempBufManager()) {
Manager_->Return(this);
@@ -163,7 +172,7 @@ void TPerThreadedBuf::Dispose() noexcept {
}
TTempBuf::TTempBuf()
- : Impl_(TempBufManager()->Aquire())
+ : Impl_(AcquireSmallBuffer(TMP_BUF_LEN))
{
}
@@ -174,7 +183,7 @@ TTempBuf::TTempBuf()
*/
static inline TTempBuf::TImpl* ConstructImpl(size_t len) {
if (len <= TMP_BUF_LEN) {
- return TempBufManager()->Aquire();
+ return AcquireSmallBuffer(len);
}
return new (len) TAllocedBuf();
