Browse Source

create new allocator when pre-allocated allocators exhausted, fix #1862

tags/20200727
nihuini 6 years ago
parent
commit
d2bf77cd88
1 changed files with 8 additions and 4 deletions
  1. +8
    -4
      src/gpu.cpp

+ 8
- 4
src/gpu.cpp View File

@@ -1596,8 +1596,10 @@ VkAllocator* VulkanDevice::acquire_blob_allocator() const
}
}

NCNN_LOGE("out of blob allocator");
return 0;
// pre-allocated allcator exhausted, create new
VkAllocator* allocator = new VkBlobAllocator(this);
blob_allocators.push_back(allocator);
return allocator;
}

void VulkanDevice::reclaim_blob_allocator(VkAllocator* allocator) const
@@ -1630,8 +1632,10 @@ VkAllocator* VulkanDevice::acquire_staging_allocator() const
}
}

NCNN_LOGE("out of staging allocator");
return 0;
// pre-allocated allcator exhausted, create new
VkAllocator* allocator = new VkStagingAllocator(this);
staging_allocators.push_back(allocator);
return allocator;
}

void VulkanDevice::reclaim_staging_allocator(VkAllocator* allocator) const


Loading…
Cancel
Save