diff --git a/cpp/velox/memory/VeloxMemoryManager.cc b/cpp/velox/memory/VeloxMemoryManager.cc index 1c62f148f3ba4..aec9e03b9c6bf 100644 --- a/cpp/velox/memory/VeloxMemoryManager.cc +++ b/cpp/velox/memory/VeloxMemoryManager.cc @@ -310,8 +310,10 @@ bool VeloxMemoryManager::tryDestructSafe() { VeloxMemoryManager::~VeloxMemoryManager() { static const uint32_t kWaitTimeoutMs = FLAGS_gluten_velox_aysnc_timeout_on_task_stopping; // 30s by default uint32_t accumulatedWaitMs = 0UL; + bool destructed = false; for (int32_t tryCount = 0; accumulatedWaitMs < kWaitTimeoutMs; tryCount++) { - if (tryDestructSafe()) { + destructed = tryDestructSafe(); + if (destructed) { if (tryCount > 0) { LOG(INFO) << "All the outstanding memory resources successfully released. "; } @@ -323,6 +325,10 @@ VeloxMemoryManager::~VeloxMemoryManager() { usleep(waitMs * 1000); accumulatedWaitMs += waitMs; } + if (!destructed) { + LOG(ERROR) << "Failed to release Velox memory manager after " << accumulatedWaitMs + << "ms as there are still outstanding memory resources. "; + } } } // namespace gluten