Fix: CUDA module memory leak since using primary context
Previously the CUDA context was always destroyed and the module along with it. Now that this no longer happens, the missing module free became a memory leak. Also fix the same issue for HIP, though this is destroying the context so it's not a problem yet. Fix part of #119035 Co-authored-by: Brecht Van Lommel <brecht@blender.org>
This commit is contained in:
committed by
Brecht Van Lommel
parent
e480b6a50c
commit
60e8b56bcd
@@ -135,7 +135,9 @@ CUDADevice::CUDADevice(const DeviceInfo &info, Stats &stats, Profiler &profiler)
|
||||
CUDADevice::~CUDADevice()
|
||||
{
|
||||
texture_info.free();
|
||||
|
||||
if (cuModule) {
|
||||
cuda_assert(cuModuleUnload(cuModule));
|
||||
}
|
||||
cuda_assert(cuDevicePrimaryCtxRelease(cuDevice));
|
||||
}
|
||||
|
||||
|
||||
@@ -126,7 +126,9 @@ HIPDevice::HIPDevice(const DeviceInfo &info, Stats &stats, Profiler &profiler)
|
||||
HIPDevice::~HIPDevice()
|
||||
{
|
||||
texture_info.free();
|
||||
|
||||
if (hipModule) {
|
||||
hip_assert(hipModuleUnload(hipModule));
|
||||
}
|
||||
hip_assert(hipCtxDestroy(hipContext));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user