From 24cae76d16d7344154c1a507889e33793b369be7 Mon Sep 17 00:00:00 2001 From: bunnei Date: Sun, 15 Nov 2020 00:36:26 -0800 Subject: common: fiber: Use VirtualBuffer for stack memory. - This will be aligned by default, and helps memory usage. --- src/common/fiber.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/common') diff --git a/src/common/fiber.cpp b/src/common/fiber.cpp index 3978c8624..3c1eefcb7 100644 --- a/src/common/fiber.cpp +++ b/src/common/fiber.cpp @@ -5,6 +5,7 @@ #include "common/assert.h" #include "common/fiber.h" #include "common/spin_lock.h" +#include "common/virtual_buffer.h" #include @@ -13,8 +14,10 @@ namespace Common { constexpr std::size_t default_stack_size = 256 * 1024; struct Fiber::FiberImpl { - alignas(64) std::array stack; - alignas(64) std::array rewind_stack; + FiberImpl() : stack{default_stack_size}, rewind_stack{default_stack_size} {} + + VirtualBuffer stack; + VirtualBuffer rewind_stack; SpinLock guard{}; std::function entry_point; -- cgit v1.2.3