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