diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h index 9531c71ff8f..79f8a311185 100644 --- a/intern/guardedalloc/MEM_guardedalloc.h +++ b/intern/guardedalloc/MEM_guardedalloc.h @@ -201,7 +201,7 @@ extern size_t (*MEM_get_peak_memory)(void) ATTR_WARN_UNUSED_RESULT; # define MEM_SAFE_FREE(v) \ do { \ if (v) { \ - MEM_freeN>>(v); \ + MEM_freeN(v); \ (v) = nullptr; \ } \ } while (0) @@ -399,21 +399,15 @@ template inline T *MEM_cnew(const char *allocation_name, const T &ot template inline void MEM_freeN(T *ptr) { - if constexpr (std::is_void_v) { - mem_guarded::internal::mem_freeN_ex(const_cast(ptr), - mem_guarded::internal::AllocationType::ALLOC_FREE); - } - else { -# ifndef _WIN32 - /* MSVC seems to consider C-style types using the MEM_CXX_CLASS_ALLOC_FUNCS as non-trivial. GCC - * and clang (both on linux and OSX) do not. - * - * So for now, disable the triviality check on Windows. */ - static_assert(std::is_trivial_v, "For non-trivial types, MEM_delete must be used."); +# ifndef _MSC_VER + /* MSVC seems to consider C-style types using the DNA_DEFINE_CXX_METHODS as non-trivial. GCC + * and clang (both on linux, OSX and clang-cl on Windows on Arm) do not. + * + * So for now, disable the triviality check on MSVC. */ + static_assert(std::is_trivial_v, "For non-trivial types, MEM_delete must be used."); # endif - mem_guarded::internal::mem_freeN_ex(const_cast(static_cast(ptr)), - mem_guarded::internal::AllocationType::ALLOC_FREE); - } + mem_guarded::internal::mem_freeN_ex(const_cast(static_cast(ptr)), + mem_guarded::internal::AllocationType::ALLOC_FREE); } /** Allocation functions (for C++ only). */ diff --git a/source/blender/gpu/vulkan/render_graph/nodes/vk_pipeline_data.cc b/source/blender/gpu/vulkan/render_graph/nodes/vk_pipeline_data.cc index ca9fbd0243e..f78c19c164a 100644 --- a/source/blender/gpu/vulkan/render_graph/nodes/vk_pipeline_data.cc +++ b/source/blender/gpu/vulkan/render_graph/nodes/vk_pipeline_data.cc @@ -56,7 +56,10 @@ void vk_pipeline_data_build_commands(VKCommandBufferInterface &command_buffer, void vk_pipeline_data_free(VKPipelineData &data) { - MEM_SAFE_FREE(data.push_constants_data); + if (data.push_constants_data) { + MEM_freeN(const_cast(data.push_constants_data)); + data.push_constants_data = nullptr; + } } void vk_index_buffer_binding_build_links(VKResourceStateTracker &resources,