Fix potential bug on memory pool (#1299)

This commit is contained in:
Antonio Filipovic 2023-10-24 22:31:36 +02:00 committed by GitHub
parent e617ff9b59
commit 0d9bd5554c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -303,6 +303,7 @@ void *PoolResource::DoAllocate(size_t bytes, size_t alignment) {
[](const auto &a, const auto &b) { return a.GetBlockSize() < b.GetBlockSize(); });
if (it != pools_.end() && it->GetBlockSize() == block_size) {
last_alloc_pool_ = &*it;
last_dealloc_pool_ = &*it;
return it->Allocate();
}
// We don't have a pool for this block_size, so insert it in the sorted