aboutsummaryrefslogtreecommitdiff
path: root/layers
diff options
context:
space:
mode:
authorMark Lobodzinski <mark@lunarg.com>2016-02-23 14:11:46 -0700
committerMark Lobodzinski <mark@lunarg.com>2016-02-23 14:13:37 -0700
commit27e4fe97725b6f87d45d4bfb00e416432e0e8453 (patch)
treeed76535f4aff4c9350419be128b6e60c3a82c29c /layers
parent610208d442af6a6581b7274e38ac6b701dab16cb (diff)
downloadusermoji-27e4fe97725b6f87d45d4bfb00e416432e0e8453.tar.xz
layers: Fix memory leak in mem_tracker
Certain codepaths could result in the validation_functions vector growing unbounded, causing performance hits in QueueSubmit.
Diffstat (limited to 'layers')
-rw-r--r--layers/mem_tracker.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/layers/mem_tracker.cpp b/layers/mem_tracker.cpp
index 72a87035..8f5d653a 100644
--- a/layers/mem_tracker.cpp
+++ b/layers/mem_tracker.cpp
@@ -573,16 +573,18 @@ clear_cmd_buf_and_mem_references(
VkBool32 skipCall = VK_FALSE;
MT_CB_INFO* pCBInfo = get_cmd_buf_info(my_data, cb);
- if (pCBInfo && (pCBInfo->pMemObjList.size() > 0)) {
- list<VkDeviceMemory> mem_obj_list = pCBInfo->pMemObjList;
- for (list<VkDeviceMemory>::iterator it=mem_obj_list.begin(); it!=mem_obj_list.end(); ++it) {
- MT_MEM_OBJ_INFO* pInfo = get_mem_obj_info(my_data, *it);
- if (pInfo) {
- pInfo->pCommandBufferBindings.remove(cb);
- pInfo->refCount--;
+ if (pCBInfo) {
+ if (pCBInfo->pMemObjList.size() > 0) {
+ list<VkDeviceMemory> mem_obj_list = pCBInfo->pMemObjList;
+ for (list<VkDeviceMemory>::iterator it=mem_obj_list.begin(); it!=mem_obj_list.end(); ++it) {
+ MT_MEM_OBJ_INFO* pInfo = get_mem_obj_info(my_data, *it);
+ if (pInfo) {
+ pInfo->pCommandBufferBindings.remove(cb);
+ pInfo->refCount--;
+ }
}
+ pCBInfo->pMemObjList.clear();
}
- pCBInfo->pMemObjList.clear();
pCBInfo->activeDescriptorSets.clear();
pCBInfo->validate_functions.clear();
}