summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTapani Pälli <tapani.palli@intel.com>2019-03-19 11:01:53 +0200
committerEmil Velikov <emil.l.velikov@gmail.com>2019-03-26 18:33:55 +0000
commit7c271fd48262c9708cd3ab4e11c1e44a8e5349ff (patch)
treea40cd3cc1c29e704e0bcd9d60f8460f74b30fc5d
parentd29dca6d1589336cd33e6fbfec01e765859036f1 (diff)
downloadmesa-7c271fd48262c9708cd3ab4e11c1e44a8e5349ff.tar.gz
anv/radv: release memory allocated by glsl types during spirv_to_nir
Fixes leaks for each glsl_type generated: ==32470== 384 bytes in 3 blocks are possibly lost in loss record 18 of 18 ==32470== at 0x483880B: malloc (vg_replace_malloc.c:309) ==32470== by 0x4C43F4A: ralloc_size (ralloc.c:119) ==32470== by 0x4C44014: rzalloc_size (ralloc.c:151) ==32470== by 0x4C44258: rzalloc_array_size (ralloc.c:215) ==32470== by 0x4D38957: glsl_type::glsl_type(glsl_struct_field const*, unsigned int, char const*) (glsl_types.cpp:114) ==32470== by 0x4D3BEED: glsl_type::get_struct_instance(glsl_struct_field const*, unsigned int, char const*) (glsl_types.cpp:1146) ==32470== by 0x4D42ECC: glsl_struct_type (nir_types.cpp:501) ==32470== by 0x4CDB5A1: vtn_handle_type (spirv_to_nir.c:1269) ==32470== by 0x4CE53DD: vtn_handle_variable_or_type_instruction (spirv_to_nir.c:4018) ==32470== by 0x4CD8CFF: vtn_foreach_instruction (spirv_to_nir.c:365) ==32470== by 0x4CE5E6B: spirv_to_nir (spirv_to_nir.c:4490) ==32470== by 0x497AF10: anv_shader_compile_to_nir (anv_pipeline.c:173) v2: move release call to vkDestroyInstance v3: apply fix also to radv driver Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> (cherry picked from commit 4e1bbb000cdfe4ba01bee5a6868c54fed7285dae)
-rw-r--r--src/amd/vulkan/radv_device.c2
-rw-r--r--src/intel/vulkan/anv_device.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 8da75510ab2..ffc2e02fd80 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -49,6 +49,7 @@
#include "util/build_id.h"
#include "util/debug.h"
#include "util/mesa-sha1.h"
+#include "compiler/glsl_types.h"
static int
radv_device_get_cache_uuid(enum radeon_family family, void *uuid)
@@ -597,6 +598,7 @@ void radv_DestroyInstance(
VG(VALGRIND_DESTROY_MEMPOOL(instance));
+ _mesa_glsl_release_types();
_mesa_locale_fini();
vk_debug_report_instance_destroy(&instance->debug_report_callbacks);
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index b96166cfe28..b460a03405a 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -41,6 +41,7 @@
#include "git_sha1.h"
#include "vk_util.h"
#include "common/gen_defines.h"
+#include "compiler/glsl_types.h"
#include "genxml/gen7_pack.h"
@@ -708,6 +709,7 @@ void anv_DestroyInstance(
vk_debug_report_instance_destroy(&instance->debug_report_callbacks);
+ _mesa_glsl_release_types();
_mesa_locale_fini();
vk_free(&instance->alloc, instance);