Skip to content

Commit edaa9e8

Browse files
committed
FIX: issue idle GC only once post execution
1 parent cbeafce commit edaa9e8

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

CHANGELOG

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
- 0.17.0.pre12 - 23-07-2025
1+
- 0.17.0.pre13 - 04-02-2025
2+
- Only issue idle GC once post dispatch - reduces CPU usage for auto cleanup - Sam Saffron
3+
4+
- 0.17.0.pre12 - 23-01-2025
25
- Corrected off-by-one error with object serialization - Ben Noordhuis
36

47
- 0.17.0.pre11 - 21-01-2025

bin/console

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env ruby
22

3-
require "bundler/setup"
3+
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
44
require "mini_racer"
55

66
# You can add fixtures and/or initialization code here to make experimenting

ext/mini_racer_extension/mini_racer_extension.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,7 @@ static void dispatch(Context *c)
728728
void v8_thread_main(Context *c, struct State *pst)
729729
{
730730
struct timespec deadline;
731+
bool issued_idle_gc = true;
731732

732733
c->pst = pst;
733734
barrier_wait(&c->late_init);
@@ -737,15 +738,18 @@ void v8_thread_main(Context *c, struct State *pst)
737738
if (c->idle_gc > 0) {
738739
deadline = deadline_ms(c->idle_gc);
739740
pthread_cond_timedwait(&c->cv, &c->mtx, &deadline);
740-
if (deadline_exceeded(deadline))
741+
if (deadline_exceeded(deadline) && !issued_idle_gc) {
741742
v8_low_memory_notification(c->pst);
743+
issued_idle_gc = true;
744+
}
742745
} else {
743746
pthread_cond_wait(&c->cv, &c->mtx);
744747
}
745748
}
746749
if (!c->req.len)
747750
continue; // spurious wakeup or quit signal from other thread
748751
dispatch(c);
752+
issued_idle_gc = false;
749753
pthread_cond_signal(&c->cv);
750754
}
751755
}

lib/mini_racer/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

33
module MiniRacer
4-
VERSION = "0.17.0.pre12"
4+
VERSION = "0.17.0.pre13"
55
LIBV8_NODE_VERSION = "~> 22.7.0.4"
66
end

0 commit comments

Comments
 (0)