Skip to content

Commit 8dbaaa1

Browse files
authored
disable defragmentation for extra memory pools (#1619)
Signed-off-by: Petr Shumilov <p.shumilov@vkteam.ru>
1 parent 5f67d23 commit 8dbaaa1

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

runtime-common/core/memory-resource/unsynchronized_pool_resource.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44

55
#include "runtime-common/core/memory-resource/unsynchronized_pool_resource.h"
66

7-
#include "common/wrappers/likely.h"
7+
#include <cstddef>
8+
#include <iterator>
89

10+
#include "common/wrappers/likely.h"
911
#include "runtime-common/core/memory-resource/details/memory_ordered_chunk_list.h"
1012

1113
namespace memory_resource {
@@ -37,7 +39,10 @@ void unsynchronized_pool_resource::perform_defragmentation() noexcept {
3739
details::memory_ordered_chunk_list mem_list{memory_begin_, memory_end_};
3840

3941
huge_pieces_.flush_to(mem_list);
40-
if (const auto fallback_resource_left_size = fallback_resource_.size(); fallback_resource_left_size > 0) {
42+
if (const auto fallback_resource_left_size{fallback_resource_.size()};
43+
fallback_resource_left_size > 0 &&
44+
!is_memory_from_extra_pool(fallback_resource_.memory_begin(), std::distance(reinterpret_cast<uint8_t*>(fallback_resource_.memory_begin()),
45+
reinterpret_cast<uint8_t*>(fallback_resource_.memory_current())))) {
4146
mem_list.add_memory(fallback_resource_.memory_current(), fallback_resource_left_size);
4247
fallback_resource_.init(nullptr, 0);
4348
}

0 commit comments

Comments
 (0)