Browse Source
Merge pull request #4948 from lioncash/page-resize
virtual_buffer: Do nothing on resize() calls with same sizes
pull/15/merge
bunnei
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
6 additions and
1 deletions
-
src/common/virtual_buffer.h
|
|
|
@ -43,9 +43,14 @@ public: |
|
|
|
} |
|
|
|
|
|
|
|
void resize(std::size_t count) { |
|
|
|
const auto new_size = count * sizeof(T); |
|
|
|
if (new_size == alloc_size) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
FreeMemoryPages(base_ptr, alloc_size); |
|
|
|
|
|
|
|
alloc_size = count * sizeof(T); |
|
|
|
alloc_size = new_size; |
|
|
|
base_ptr = reinterpret_cast<T*>(AllocateMemoryPages(alloc_size)); |
|
|
|
} |
|
|
|
|
|
|
|
|