[Mesa-dev] [PATCH] radv: fix a little memleak when we keep shader info

Samuel Pitoiset samuel.pitoiset at gmail.com
Mon Jul 23 14:27:48 UTC 2018



On 07/23/2018 04:02 PM, Bas Nieuwenhuizen wrote:
> On Mon, Jul 23, 2018 at 1:50 PM, Samuel Pitoiset
> <samuel.pitoiset at gmail.com> wrote:
>> When we keep shader info for eg. RADV_TRACE_FILE, we don't
>> free the NIR when creating the pipelines. Though, we have to
>> free it when destroying the shader module.
>>
>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>> ---
>>   src/amd/vulkan/radv_shader.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
>> index aac5b8a21a..ef7c41af9e 100644
>> --- a/src/amd/vulkan/radv_shader.c
>> +++ b/src/amd/vulkan/radv_shader.c
>> @@ -599,8 +599,8 @@ shader_variant_create(struct radv_device *device,
>>          if (device->keep_shader_info) {
>>                  variant->disasm_string = binary.disasm_string;
>>                  variant->llvm_ir_string = binary.llvm_ir_string;
>> +               variant->nir = *shaders;
> 
> How does this work with merged shaders?

You are right. I figured this on friday but I totally forgot during the 
weekend. :)

This still leaks memory for merged shaders.

> 
>>                  if (!gs_copy_shader && !module->nir) {
>> -                       variant->nir = *shaders;
>>                          variant->spirv = (uint32_t *)module->data;
>>                          variant->spirv_size = module->size;
>>                  }
>> --
>> 2.18.0
>>
>> _______________________________________________
>> 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