aboutsummaryrefslogtreecommitdiff
path: root/src/http_client_async.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2023-08-24 19:39:00 -0700
committerGravatar GitHub <noreply@github.com> 2023-08-24 19:39:00 -0700
commit8a48e8bb0b7de985a96b3a4cae389e3294a2c0e3 (patch)
tree20d8dc382512313061c20296d1e33e8d18fbbde3 /src/http_client_async.zig
parent097ae4e982a9cbcae6b4886c4efb82d452629b99 (diff)
downloadbun-8a48e8bb0b7de985a96b3a4cae389e3294a2c0e3.tar.gz
bun-8a48e8bb0b7de985a96b3a4cae389e3294a2c0e3.tar.zst
bun-8a48e8bb0b7de985a96b3a4cae389e3294a2c0e3.zip
Report extra memory more (#4289)
* Report memory allocated in fetch * Memory size reporting to `Headers` * Fixup memory reporting allocator * Make these tests do more * cleanup some of this --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/http_client_async.zig')
-rw-r--r--src/http_client_async.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/http_client_async.zig b/src/http_client_async.zig
index 26978db22..09319966e 100644
--- a/src/http_client_async.zig
+++ b/src/http_client_async.zig
@@ -2571,8 +2571,8 @@ fn cloneMetadata(this: *HTTPClient) void {
var builder = &builder_;
this.state.pending_response.count(builder);
builder.count(this.url.href);
- builder.allocate(bun.default_allocator) catch unreachable;
- var headers_buf = bun.default_allocator.alloc(picohttp.Header, this.state.pending_response.headers.len) catch unreachable;
+ builder.allocate(this.allocator) catch unreachable;
+ var headers_buf = this.allocator.alloc(picohttp.Header, this.state.pending_response.headers.len) catch unreachable;
const response = this.state.pending_response.clone(headers_buf, builder);
this.state.pending_response = response;
@@ -2665,9 +2665,9 @@ pub const HTTPClientResult = struct {
href: []const u8 = "",
headers_buf: []picohttp.Header = &.{},
- pub fn deinit(this: *ResultMetadata) void {
- if (this.metadata_buf.len > 0) bun.default_allocator.free(this.metadata_buf);
- if (this.headers_buf.len > 0) bun.default_allocator.free(this.headers_buf);
+ pub fn deinit(this: *ResultMetadata, allocator: std.mem.Allocator) void {
+ if (this.metadata_buf.len > 0) allocator.free(this.metadata_buf);
+ if (this.headers_buf.len > 0) allocator.free(this.headers_buf);
this.headers_buf = &.{};
this.metadata_buf = &.{};
this.href = "";