Refactor: Cycles: Simplify util_guarded_mem_alloc/free calls

Pull Request: https://projects.blender.org/blender/blender/pulls/132912
This commit is contained in:
Brecht Van Lommel
2025-01-09 12:04:08 +01:00
parent 1fc73188e3
commit 0e8a7c751a
6 changed files with 25 additions and 27 deletions

View File

@@ -47,10 +47,7 @@ void *device_memory::host_alloc(const size_t size)
void *ptr = util_aligned_malloc(size, MIN_ALIGNMENT_CPU_DATA_TYPES);
if (ptr) {
util_guarded_mem_alloc(size);
}
else {
if (ptr == nullptr) {
throw std::bad_alloc();
}
@@ -60,8 +57,7 @@ void *device_memory::host_alloc(const size_t size)
void device_memory::host_free()
{
if (host_pointer) {
util_guarded_mem_free(memory_size());
util_aligned_free(host_pointer);
util_aligned_free(host_pointer, memory_size());
host_pointer = nullptr;
}
}