fix: std.http per-request arenas are backed by the server's own allocator

No conjured GPA: the arena chunks come from own_alloc (captured at
Server.init), so all server memory flows from the allocator the app
constructed it with — the point of the implicit context model.
This commit is contained in:
agra
2026-06-12 21:37:39 +03:00
parent 0db4262833
commit f3aa2716ae

View File

@@ -455,8 +455,7 @@ Server :: struct {
// be parsed as a dot-call on a function named `handler`.)
h := self.handler;
resp : Response = .{};
req_gpa := GPA.init();
req_arena := Arena.init(xx req_gpa, 65536);
req_arena := Arena.init(self.own_alloc, 65536);
push Context.{ allocator = xx req_arena } {
h(@req, @resp, self.ctx);
self.serialize_response(slot, @resp, keep);
@@ -542,8 +541,7 @@ Server :: struct {
respond_error_close :: (self: *Server, slot: i64, status: i64) {
resp : Response = .{ status = status, body = reason_for(status) };
self.conns[slot].read_len = 0;
err_gpa := GPA.init();
err_arena := Arena.init(xx err_gpa, 4096);
err_arena := Arena.init(self.own_alloc, 4096);
push Context.{ allocator = xx err_arena } {
self.serialize_response(slot, @resp, false);
}