[Bf-blender-cvs] [26b45448abf] master: Fix: Memory Leak When Using Compositor.
Jeroen Bakker
noreply at git.blender.org
Wed Mar 24 11:58:44 CET 2021
Commit: 26b45448abf05dc709678cb821201b0721a51d76
Author: Jeroen Bakker
Date: Wed Mar 24 11:56:58 2021 +0100
Branches: master
https://developer.blender.org/rB26b45448abf05dc709678cb821201b0721a51d76
Fix: Memory Leak When Using Compositor.
When using the compositor inlined static vectors could allocate
memory. This memory wasn't freed. This patch would make them inline
again.
===================================================================
M source/blender/compositor/intern/COM_WorkScheduler.cc
===================================================================
diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cc b/source/blender/compositor/intern/COM_WorkScheduler.cc
index 2bc3ff936b1..56956b9d097 100644
--- a/source/blender/compositor/intern/COM_WorkScheduler.cc
+++ b/source/blender/compositor/intern/COM_WorkScheduler.cc
@@ -284,12 +284,13 @@ static void opencl_deinitialize()
{
/* Deinitialize OpenCL GPU's. */
if (g_work_scheduler.opencl.initialized) {
- Device *device;
while (!g_work_scheduler.opencl.devices.is_empty()) {
- device = g_work_scheduler.opencl.devices.pop_last();
+ Device *device = g_work_scheduler.opencl.devices.pop_last();
device->deinitialize();
delete device;
}
+ g_work_scheduler.opencl.devices.clear_and_make_inline();
+
if (g_work_scheduler.opencl.program) {
clReleaseProgram(g_work_scheduler.opencl.program);
g_work_scheduler.opencl.program = nullptr;
@@ -397,12 +398,13 @@ static void threading_model_queue_deinitialize()
{
/* deinitialize CPU threads */
if (g_work_scheduler.queue.initialized) {
- Device *device;
while (!g_work_scheduler.queue.devices.is_empty()) {
- device = g_work_scheduler.queue.devices.pop_last();
+ Device *device = g_work_scheduler.queue.devices.pop_last();
device->deinitialize();
delete device;
}
+ g_work_scheduler.queue.devices.clear_and_make_inline();
+
BLI_thread_local_delete(g_thread_device);
g_work_scheduler.queue.initialized = false;
}
More information about the Bf-blender-cvs
mailing list