| 187 | } |
| 188 | |
| 189 | bool IsDebugEnabled() { |
| 190 | static const bool is_enabled = []() { |
| 191 | auto maybe_env_value = internal::GetEnvVar(kDebugMemoryEnvVar); |
| 192 | if (!maybe_env_value.ok()) { |
| 193 | return false; |
| 194 | } |
| 195 | auto env_value = *std::move(maybe_env_value); |
| 196 | if (env_value.empty() || env_value == "none") { |
| 197 | return false; |
| 198 | } |
| 199 | auto debug_state = DebugState::Instance(); |
| 200 | if (env_value == "abort") { |
| 201 | debug_state->SetHandler(DebugAbort); |
| 202 | return true; |
| 203 | } |
| 204 | if (env_value == "trap") { |
| 205 | debug_state->SetHandler(DebugTrap); |
| 206 | return true; |
| 207 | } |
| 208 | if (env_value == "warn") { |
| 209 | debug_state->SetHandler(DebugWarn); |
| 210 | return true; |
| 211 | } |
| 212 | ARROW_LOG(WARNING) << "Invalid value for " << kDebugMemoryEnvVar << ": '" << env_value |
| 213 | << "'. Valid values are 'abort', 'trap', 'warn', 'none'."; |
| 214 | return false; |
| 215 | }(); |
| 216 | |
| 217 | return is_enabled; |
| 218 | } |
| 219 | |
| 220 | // An allocator wrapper that adds a suffix at the end of allocation to check |
| 221 | // for writes beyond the allocated area. |
no test coverage detected