authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-03-31 14:57:12-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-10-29 06:20:48-07:00
log8773b632418adb23cfda847f69e971e90eb6d3a7
tree9771bca84365981063a471c8e65b0311c7650ff3
parent266bcfbf2f9fc6fa2c13229f8a00d57e57613c91

EventLoop: take DetachedClosure into account when allocating


1 files changed, 4 insertions(+), 4 deletions(-)

lib/std/Io/EventLoop.zig+4-4
...@@ -68,13 +68,13 @@ const Fiber = struct {...@@ -68,13 +68,13 @@ const Fiber = struct {
68 const min_stack_size = 4 * 1024 * 1024;68 const min_stack_size = 4 * 1024 * 1024;
69 const max_context_align: Alignment = .@"16";69 const max_context_align: Alignment = .@"16";
70 const max_context_size = max_context_align.forward(1024);70 const max_context_size = max_context_align.forward(1024);
71 const max_closure_size: usize = @max(@sizeOf(AsyncClosure), @sizeOf(DetachedClosure));
72 const max_closure_align: Alignment = .max(.of(AsyncClosure), .of(DetachedClosure));
71 const allocation_size = std.mem.alignForward(73 const allocation_size = std.mem.alignForward(
72 usize,74 usize,
73 std.mem.alignForward(75 max_closure_align.max(max_context_align).forward(
74 usize,
75 max_result_align.forward(@sizeOf(Fiber)) + max_result_size + min_stack_size,76 max_result_align.forward(@sizeOf(Fiber)) + max_result_size + min_stack_size,
76 @max(@alignOf(AsyncClosure), max_context_align.toByteUnits()),77 ) + max_closure_size + max_context_size,
77 ) + @sizeOf(AsyncClosure) + max_context_size,
78 std.heap.page_size_max,78 std.heap.page_size_max,
79 );79 );
8080