-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Description
Describe the enhancement requested
From the discussion at #41335 (comment), the arrow::util::TempVectorStack memory initialization (by filling 0xFFs [1]) seems not very useful in the sense that:
- If it is supposed to be work with the guards [2] at the edge of each stack frame, the guards are only checked in debug mode (note it is using
ARROW_DCHECK) [3], making filling0xFFs unnecessary in non-debug mode. And the debug-only guarding itself can fully leverage more decent memory poisoning strategy such as ASAN [4]. - If it is for non-debug mode too, then it might be unnecessary because the stack users are not assuming the stack memory to be initially filled with any particular content.
We may want to refine this by removing unnecessary memory initialization and/or using ASAN's manual memory poisoning.
[1]
arrow/cpp/src/arrow/compute/util.h
Line 95 in e4f3146
| std::memset(buffer->mutable_data(), 0xFF, size); |
[2]
arrow/cpp/src/arrow/compute/util.h
Lines 117 to 118 in e4f3146
| static constexpr uint64_t kGuard1 = 0x3141592653589793ULL; | |
| static constexpr uint64_t kGuard2 = 0x0577215664901532ULL; |
[3]
arrow/cpp/src/arrow/compute/util.cc
Lines 52 to 57 in e4f3146
| ARROW_DCHECK(reinterpret_cast<const uint64_t*>(buffer_->mutable_data() + top_)[-1] == | |
| kGuard2); | |
| ARROW_DCHECK(top_ >= size); | |
| top_ -= size; | |
| ARROW_DCHECK(reinterpret_cast<const uint64_t*>(buffer_->mutable_data() + top_)[0] == | |
| kGuard1); |
[4] https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning
Component(s)
C++