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

Function IsDebugEnabled

cpp/src/arrow/memory_pool.cc:184–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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