From e0503faec787f2c1b574918e798f2bb514f0ea42 Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Thu, 1 Dec 2022 02:36:18 -0800 Subject: [PATCH] Increase sensitivity of GC timers --- src/bun.js/event_loop.zig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bun.js/event_loop.zig b/src/bun.js/event_loop.zig index aac1e3dcde..53b6dcf1f3 100644 --- a/src/bun.js/event_loop.zig +++ b/src/bun.js/event_loop.zig @@ -365,7 +365,8 @@ pub const EventLoop = struct { switch (this.gc_timer_state) { .run_on_next_tick => { - if (this_heap_size > prev) { + // When memory usage is not stable, run the GC more. + if (this_heap_size != prev) { this.scheduleGCTimer(); this.updateGCRepeatTimer(.fast); } else { @@ -375,7 +376,7 @@ pub const EventLoop = struct { this.gc_last_heap_size = this_heap_size; }, .pending => { - if (this_heap_size > prev) { + if (this_heap_size != prev) { this.updateGCRepeatTimer(.fast); if (this_heap_size > prev * 2) {