Skip to content

Commit 8223385

Browse files
committed
Update svs_allocator.patch
1 parent 7a11209 commit 8223385

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

cmake/svs_allocator.patch

+16-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
11
diff --git a/include/svs/lib/memory.h b/include/svs/lib/memory.h
2-
index c79fff1..dcc015b 100644
2+
index c79fff1..7f55390 100644
33
--- a/include/svs/lib/memory.h
44
+++ b/include/svs/lib/memory.h
55
@@ -61,7 +61,7 @@ template <typename T> struct Allocator {
66
}
77

88
constexpr void deallocate(value_type* ptr, size_t count) noexcept {
99
- ::operator delete(ptr, count);
10-
+ ::operator delete(ptr, count, std::align_val_t(alignof(T)));
10+
+ ::operator delete(static_cast<void*>(ptr), sizeof(T) * count, std::align_val_t(alignof(T)));
1111
}
1212

1313
// Intercept zero-argument construction to do default initialization.
14+
diff --git a/include/svs/lib/threads/threadlocal.h b/include/svs/lib/threads/threadlocal.h
15+
index f6d399f..5fdebd2 100644
16+
--- a/include/svs/lib/threads/threadlocal.h
17+
+++ b/include/svs/lib/threads/threadlocal.h
18+
@@ -82,7 +82,8 @@ template <typename T, size_t Alignment = CACHE_LINE_BYTES> struct AlignedAllocat
19+
}
20+
21+
void deallocate(value_type* ptr, size_t count) noexcept {
22+
- ::operator delete(ptr, count, std::align_val_t{alignment});
23+
+ size_t bytes = alignment * lib::div_round_up(sizeof(T) * count, alignment);
24+
+ ::operator delete(static_cast<void*>(ptr), bytes, std::align_val_t{alignment});
25+
}
26+
};
27+

0 commit comments

Comments
 (0)