commit 8773b632418adb23cfda847f69e971e90eb6d3a7 (tree)
parent 266bcfbf2f9fc6fa2c13229f8a00d57e57613c91
Author: Andrew Kelley <andrew@ziglang.org>
Date: Mon, 31 Mar 2025 14:57:12 -0700
EventLoop: take DetachedClosure into account when allocating
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/std/Io/EventLoop.zig b/lib/std/Io/EventLoop.zig
@@ -68,13 +68,13 @@ const Fiber = struct {
const min_stack_size = 4 * 1024 * 1024;
const max_context_align: Alignment = .@"16";
const max_context_size = max_context_align.forward(1024);
+ const max_closure_size: usize = @max(@sizeOf(AsyncClosure), @sizeOf(DetachedClosure));
+ const max_closure_align: Alignment = .max(.of(AsyncClosure), .of(DetachedClosure));
const allocation_size = std.mem.alignForward(
usize,
- std.mem.alignForward(
- usize,
+ max_closure_align.max(max_context_align).forward(
max_result_align.forward(@sizeOf(Fiber)) + max_result_size + min_stack_size,
- @max(@alignOf(AsyncClosure), max_context_align.toByteUnits()),
- ) + @sizeOf(AsyncClosure) + max_context_size,
+ ) + max_closure_size + max_context_size,
std.heap.page_size_max,
);