[Mesa-dev] [PATCH] radv: free attachments on end command buffer.

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Mon Nov 6 00:56:04 UTC 2017


Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>

On Mon, Nov 6, 2017 at 1:37 AM, Dave Airlie <airlied at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> If we allocate attachments in the begin command buffer due to the
> render pass continue bit, we were leaking them.
>
> Since renderpasses inside a cmd buffer malloc/free these properly,
> and set to NULL, we just need to call free at end.
>
> Fixes a memory leak with multithreading demo.
>
> Cc: "17.2 17.3" <mesa-stable at lists.freedesktop.org>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  src/amd/vulkan/radv_cmd_buffer.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
> index fa378423e00..5f8b1c3c989 100644
> --- a/src/amd/vulkan/radv_cmd_buffer.c
> +++ b/src/amd/vulkan/radv_cmd_buffer.c
> @@ -2515,6 +2515,8 @@ VkResult radv_EndCommandBuffer(
>                 si_emit_cache_flush(cmd_buffer);
>         }
>
> +       vk_free(&cmd_buffer->pool->alloc, cmd_buffer->state.attachments);
> +
>         if (!cmd_buffer->device->ws->cs_finalize(cmd_buffer->cs))
>                 return VK_ERROR_OUT_OF_DEVICE_MEMORY;
>
> --
> 2.14.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list