From d2bf77cd88efb15f9ce0f796e414df9f9dbf5a6d Mon Sep 17 00:00:00 2001 From: nihuini Date: Wed, 24 Jun 2020 15:23:17 +0800 Subject: [PATCH] create new allocator when pre-allocated allocators exhausted, fix #1862 --- src/gpu.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gpu.cpp b/src/gpu.cpp index a732d7b04..a8f5b3ccb 100644 --- a/src/gpu.cpp +++ b/src/gpu.cpp @@ -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