From b230e7a73a78e67533cba0d852cefdbbd787eae9 Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Sat, 19 Nov 2022 22:34:57 -0800 Subject: [fetch] Fix sporadic data corruption bug in HTTP client and add fast path - This removes memory pooling from the HTTP client which sometimes caused invalid memory to be written to the response body. - This adds a fast path for small HTTP/HTTPS responses that makes it a single memory allocation for the response body, instead of copying & allocating a temporary buffer cc @Electroid --- src/bun.js/javascript.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/bun.js/javascript.zig') diff --git a/src/bun.js/javascript.zig b/src/bun.js/javascript.zig index 80e5c43e1..4897ab562 100644 --- a/src/bun.js/javascript.zig +++ b/src/bun.js/javascript.zig @@ -436,10 +436,10 @@ pub const VirtualMachine = struct { modules: ModuleLoader.AsyncModule.Queue = .{}, aggressive_garbage_collection: GCLevel = GCLevel.none, - pub const GCLevel = enum { - none, - mild, - aggressive, + pub const GCLevel = enum(u3) { + none = 0, + mild = 1, + aggressive = 2, }; pub threadlocal var is_main_thread_vm: bool = false; -- cgit v1.2.3