diff --git a/cpp/velox/compute/WholeStageResultIterator.cc b/cpp/velox/compute/WholeStageResultIterator.cc index c1ae6f218458..7deb9b56a062 100644 --- a/cpp/velox/compute/WholeStageResultIterator.cc +++ b/cpp/velox/compute/WholeStageResultIterator.cc @@ -192,6 +192,7 @@ std::shared_ptr WholeStageResultIterator::createNewVeloxQ std::shared_ptr WholeStageResultIterator::next() { tryAddSplitsToTask(); + GLUTEN_CHECK(task_ != nullptr, "task_ is nullptr"); if (task_->isFinished()) { return nullptr; } diff --git a/cpp/velox/memory/VeloxMemoryManager.cc b/cpp/velox/memory/VeloxMemoryManager.cc index 597ce1c9da37..bad535f20d89 100644 --- a/cpp/velox/memory/VeloxMemoryManager.cc +++ b/cpp/velox/memory/VeloxMemoryManager.cc @@ -126,7 +126,7 @@ class ListenableArbitrator : public velox::memory::MemoryArbitrator { uint64_t shrinkCapacity(uint64_t targetBytes, bool allowSpill, bool allowAbort) override { velox::memory::ScopedMemoryArbitrationContext ctx{}; facebook::velox::exec::MemoryReclaimer::Stats status; - velox::memory::MemoryPool* pool; + velox::memory::MemoryPool* pool = nullptr; { std::unique_lock guard{mutex_}; VELOX_CHECK_EQ(candidates_.size(), 1, "ListenableArbitrator should only be used within a single root pool"); @@ -178,7 +178,7 @@ class ListenableArbitrator : public velox::memory::MemoryArbitrator { return freeBytes; } - gluten::AllocationListener* listener_; + gluten::AllocationListener* listener_ = nullptr; const uint64_t memoryPoolInitialCapacity_; // FIXME: Unused. const uint64_t memoryPoolTransferCapacity_; const uint64_t memoryReclaimMaxWaitMs_; @@ -216,6 +216,7 @@ class ArbitratorFactoryRegister { VeloxMemoryManager::VeloxMemoryManager(const std::string& kind, std::unique_ptr listener) : MemoryManager(kind), listener_(std::move(listener)) { + GLUTEN_CHECK(listener_ != nullptr, "VeloxMemoryManager failed"); auto reservationBlockSize = VeloxBackend::get()->getBackendConf()->get( kMemoryReservationBlockSize, kMemoryReservationBlockSizeDefault); auto memInitCapacity =