aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDaniel Rakos <daniel.rakos@rastergrid.com>2023-06-22 11:20:54 +0200
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>2023-06-22 11:07:13 -0600
commit8cf2cdd2c9d53cb26a4e32b7e677bf7e37900cfc (patch)
tree6e0967140e0bb201ffbe4fc142a0750f099d4999 /scripts
parent41c8e28fe2db3ea620c85804492fdecd287d4b87 (diff)
downloadusermoji-8cf2cdd2c9d53cb26a4e32b7e677bf7e37900cfc.tar.xz
mock: Fix memory leak issue
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mock_icd_generator.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/mock_icd_generator.py b/scripts/mock_icd_generator.py
index 95166616..b09abb8c 100644
--- a/scripts/mock_icd_generator.py
+++ b/scripts/mock_icd_generator.py
@@ -77,6 +77,12 @@ CUSTOM_C_INTERCEPTS = {
DestroyDispObjHandle((void*) pCommandBuffers[i]);
}
''',
+'vkCreateCommandPool': '''
+ unique_lock_t lock(global_lock);
+ *pCommandPool = (VkCommandPool)global_unique_handle++;
+ command_pool_map[device].insert(*pCommandPool);
+ return VK_SUCCESS;
+''',
'vkDestroyCommandPool': '''
// destroy command buffers for this pool
unique_lock_t lock(global_lock);
@@ -87,6 +93,7 @@ CUSTOM_C_INTERCEPTS = {
}
command_pool_buffer_map.erase(it);
}
+ command_pool_map[device].erase(commandPool);
''',
'vkEnumeratePhysicalDevices': '''
VkResult result_code = VK_SUCCESS;
@@ -115,6 +122,14 @@ CUSTOM_C_INTERCEPTS = {
}
}
+ for (auto& cp : command_pool_map[device]) {
+ for (auto& cb : command_pool_buffer_map[cp]) {
+ DestroyDispObjHandle((void*) cb);
+ }
+ command_pool_buffer_map.erase(cp);
+ }
+ command_pool_map[device].clear();
+
queue_map.erase(device);
buffer_map.erase(device);
image_memory_size_map.erase(device);