From a862fc08b12b84d95b98ea0cfd56a17de92680ee Mon Sep 17 00:00:00 2001 From: Sam Saffron Date: Sun, 15 Sep 2024 11:30:30 +1000 Subject: [PATCH] Version bump --- CHANGELOG | 4 +++ lib/mini_racer/version.rb | 4 +-- test/test_multithread.rb | 76 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 test/test_multithread.rb diff --git a/CHANGELOG b/CHANGELOG index 750b606..767609f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +- 0.17.0.pre3 - 15-09-2024 + + - Text clang based Linux v8 build, in case there is an edge case with GCC compilation + - 0.17.0.pre2 - 09-09-2024 - Test build to see if disabling Maglev optimisations resolves segfault issues diff --git a/lib/mini_racer/version.rb b/lib/mini_racer/version.rb index 62bda5b..49a4fb8 100644 --- a/lib/mini_racer/version.rb +++ b/lib/mini_racer/version.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true module MiniRacer - VERSION = "0.17.0.pre2" - LIBV8_NODE_VERSION = "~> 22.7.0.3" + VERSION = "0.17.0.pre3" + LIBV8_NODE_VERSION = "~> 22.7.0.4" end diff --git a/test/test_multithread.rb b/test/test_multithread.rb new file mode 100644 index 0000000..0b7ec17 --- /dev/null +++ b/test/test_multithread.rb @@ -0,0 +1,76 @@ +# use bundle exec to run this script +# +require 'securerandom' + + + context = nil + + Thread.new do + require "mini_racer" + context = MiniRacer::Context.new + end.join + + Thread.new do + context.isolate.low_memory_notification + + start_heap = context.heap_stats[:used_heap_size] + + context.eval("'#{"x" * 1_000_000_0}'") + + + end_heap = context.heap_stats[:used_heap_size] + + p end_heap - start_heap + end.join + + Thread.new do + 10.times do + context.isolate.low_memory_notification + end + end_heap = context.heap_stats[:used_heap_size] + p end_heap + end.join + exit + + +ctx = nil + +big_eval = +"" + +(0..100).map do |j| + big_regex = (1..10000).map { |i| SecureRandom.hex }.join("|") + big_eval << "X[#{j}] = /#{big_regex}/;\n" +end + +big_eval = <<~JS + const X = []; + #{big_eval} + + function test(i, str) { + return X[i].test(str); + } + + null; +JS + +Thread + .new do + require "mini_racer" + ctx = MiniRacer::Context.new + ctx.eval("var a = 1+1") + ctx.eval(big_eval) + end + .join + +3.times { GC.start } + + +Thread + .new do + 10.times do + 10.times { |i| p ctx.eval "test(#{i}, '#{SecureRandom.hex}')" } + end + end + .join + +GC.start