MCPcopy Create free account
hub / github.com/apache/arrow / IsDebugEnabled

Function IsDebugEnabled

cpp/src/arrow/memory_pool.cc:189–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

187}
188
189bool 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.

Callers 4

CreateDefaultMethod · 0.85
system_memory_poolMethod · 0.85
jemalloc_memory_poolMethod · 0.85
mimalloc_memory_poolMethod · 0.85

Calls 4

GetEnvVarFunction · 0.85
SetHandlerMethod · 0.80
okMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected