From 319b0effa1a503f382e483a5cce4746491880ef1 Mon Sep 17 00:00:00 2001 From: stangamecai Date: Mon, 16 Oct 2023 19:50:35 +0800 Subject: [PATCH 1/2] - [bug fix] fixed memory issue in allocateCommandBuffers function; --- .../runtime/function/render/interface/vulkan/vulkan_rhi.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/source/runtime/function/render/interface/vulkan/vulkan_rhi.cpp b/engine/source/runtime/function/render/interface/vulkan/vulkan_rhi.cpp index e684a0f8f..734dbb082 100644 --- a/engine/source/runtime/function/render/interface/vulkan/vulkan_rhi.cpp +++ b/engine/source/runtime/function/render/interface/vulkan/vulkan_rhi.cpp @@ -3030,7 +3030,7 @@ namespace Piccolo command_buffer_allocate_info.commandBufferCount = pAllocateInfo->commandBufferCount; VkCommandBuffer vk_command_buffer; - pCommandBuffers = new RHICommandBuffer(); + pCommandBuffers = new VulkanCommandBuffer(); VkResult result = vkAllocateCommandBuffers(m_device, &command_buffer_allocate_info, &vk_command_buffer); ((VulkanCommandBuffer*)pCommandBuffers)->setResource(vk_command_buffer); From a83d2ffdd75aa652da538d7a4fcafbc2d93d7188 Mon Sep 17 00:00:00 2001 From: stangamecai Date: Mon, 16 Oct 2023 19:50:50 +0800 Subject: [PATCH 2/2] - [bug fix] fixed memory leak issue in UI_Pass; --- engine/source/runtime/function/render/passes/ui_pass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/source/runtime/function/render/passes/ui_pass.cpp b/engine/source/runtime/function/render/passes/ui_pass.cpp index 0caef5c89..c81bbda53 100644 --- a/engine/source/runtime/function/render/passes/ui_pass.cpp +++ b/engine/source/runtime/function/render/passes/ui_pass.cpp @@ -49,7 +49,7 @@ namespace Piccolo allocInfo.commandPool = m_rhi->getCommandPoor(); allocInfo.commandBufferCount = 1; - RHICommandBuffer* commandBuffer = new VulkanCommandBuffer(); + RHICommandBuffer* commandBuffer = nullptr; if (RHI_SUCCESS != m_rhi->allocateCommandBuffers(&allocInfo, commandBuffer)) { throw std::runtime_error("failed to allocate command buffers!");