Details
-
Sub-task
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
ghx-label-2
Description
For example:
RuntimeState::ReleaseResources()
void RuntimeState::ReleaseResources() { UnregisterReaderContexts(); if (filter_bank_ != nullptr) filter_bank_->Close(); if (resource_pool_ != nullptr) { exec_env_->thread_mgr()->UnregisterPool(resource_pool_); } block_mgr_.reset(); // Release any block mgr memory, if this is the last reference. codegen_.reset(); // Release any memory associated with codegen. // Release the reservation, which should be unused at the point. if (instance_buffer_reservation_ != nullptr) instance_buffer_reservation_->Close(); // 'query_mem_tracker()' must be valid as long as 'instance_mem_tracker_' is so // delete 'instance_mem_tracker_' first. // LogUsage() walks the MemTracker tree top-down when the memory limit is exceeded, so // break the link between 'instance_mem_tracker_' and its parent before // 'instance_mem_tracker_' and its children are destroyed. instance_mem_tracker_->UnregisterFromParent(); <======= if (instance_mem_tracker_->consumption() != 0) { LOG(WARNING) << "Query " << query_id() << " may have leaked memory." << endl << instance_mem_tracker_->LogUsage(); } instance_mem_tracker_.reset(); <======= if (local_query_state_.get() != nullptr) { // if we created this QueryState, we must call ReleaseResources() local_query_state_->ReleaseResources(); } }