diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-09-04 15:22:40 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-09-04 15:25:12 +0400 |
commit | fbed2047c8e84a535c32bf3f3fb3ea1791a08571 (patch) | |
tree | bb3f7060849b481f2235ac1ea50dd1caa5efd9c3 /intern/cycles/device/device_opencl.cpp | |
parent | 5e3b63a22bfd2f0b6fb683f1ebcac1dc96fc1627 (diff) |
Fix wrong track of the memory when doing device vector resize before freeing it
This is rather legit case which happens i.e. when having persistent images enabled
and session is updating the lookup tables.
Now device_memory keeps track of amount of memory being allocated on the device,
which makes freeing using the proper allocated size, not the CPU side buffer
size.
Diffstat (limited to 'intern/cycles/device/device_opencl.cpp')
-rw-r--r-- | intern/cycles/device/device_opencl.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp index 82419cd62b1..d950d084cd4 100644 --- a/intern/cycles/device/device_opencl.cpp +++ b/intern/cycles/device/device_opencl.cpp @@ -794,6 +794,7 @@ public: opencl_assert_err(ciErr, "clCreateBuffer"); stats.mem_alloc(size); + mem.device_size = size; } void mem_copy_to(device_memory& mem) @@ -825,7 +826,8 @@ public: opencl_assert(clReleaseMemObject(CL_MEM_PTR(mem.device_pointer))); mem.device_pointer = 0; - stats.mem_free(mem.memory_size()); + stats.mem_free(mem.device_size); + mem.device_size = 0; } } |