diff options
author | 2022-11-19 22:34:57 -0800 | |
---|---|---|
committer | 2022-11-19 22:34:57 -0800 | |
commit | b230e7a73a78e67533cba0d852cefdbbd787eae9 (patch) | |
tree | c720a12d0bc6af9f8b3a6f053a8eefbb2ca50e76 /src/bun.js/javascript.zig | |
parent | e024116b776efc19b92d4be613c1449213690ca1 (diff) | |
download | bun-b230e7a73a78e67533cba0d852cefdbbd787eae9.tar.gz bun-b230e7a73a78e67533cba0d852cefdbbd787eae9.tar.zst bun-b230e7a73a78e67533cba0d852cefdbbd787eae9.zip |
[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
Diffstat (limited to 'src/bun.js/javascript.zig')
-rw-r--r-- | src/bun.js/javascript.zig | 8 |
1 files changed, 4 insertions, 4 deletions
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; |