diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_loader_context.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_loader_context.cpp index 72c71fa5fc..ad3d7ad831 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_loader_context.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_loader_context.cpp @@ -358,6 +358,10 @@ bool RegionMemory::Freeze() { memcpy(ptr_, host_ptr_, size_); } + // Free host buffer + HSA::hsa_memory_free(host_ptr_); + host_ptr_ = nullptr; + // Invalidate agent caches which may hold lines of the new allocation. if (is_code_ && (region_->owner()->device_type() == core::Agent::kAmdGpuDevice)) ((AMD::GpuAgent*)region_->owner())->InvalidateCodeCaches();