Relax mg assert condition on dealloc (#1492)

This commit is contained in:
Antonio Filipovic 2023-12-05 13:44:06 +01:00 committed by GitHub
parent 74fa6d21f6
commit eceed274d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -331,8 +331,7 @@ void PoolResource::DoDeallocate(void *p, size_t bytes, size_t alignment) {
return;
}
// Deallocate a regular block, first check if last_dealloc_pool_ is suitable.
MG_ASSERT(last_dealloc_pool_, "Failed deallocation");
if (last_dealloc_pool_->GetBlockSize() == block_size) return last_dealloc_pool_->Deallocate(p);
if (last_dealloc_pool_ && last_dealloc_pool_->GetBlockSize() == block_size) return last_dealloc_pool_->Deallocate(p);
// Find the pool with equal block_size.
impl::Pool pool(block_size, max_blocks_per_chunk_, GetUpstreamResource());
auto it = std::lower_bound(pools_.begin(), pools_.end(), pool,