PERF: ensure we run full GC on contexts

Prior to this change we would never clear memory from contexts and
rely on V8 reacting to pressure

This could lead to bloating of PrettyText and Transpiler contexts

This optimisations ensures that we will clear memory 2 seconds after
the last eval on the context
This commit is contained in:
Sam Saffron
2020-05-15 14:01:54 +10:00
parent 0cbaa8d813
commit 4601833e4e
4 changed files with 4 additions and 4 deletions

View File

@ -65,7 +65,7 @@ module PrettyText
end
def self.create_es6_context
ctx = MiniRacer::Context.new(timeout: 25000)
ctx = MiniRacer::Context.new(timeout: 25000, ensure_gc_after_idle: 2000)
ctx.eval("window = {}; window.devicePixelRatio = 2;") # hack to make code think stuff is retina