Code Monkey home page Code Monkey logo

Comments (5)

lloeki avatar lloeki commented on August 17, 2024 1

Yeah, I rebased so the commit sha changed to the one you mentioned but that's the one.

from mini_racer.

lloeki avatar lloeki commented on August 17, 2024

Using it would therefore make low_memory_notification useless while the isolate is not in use, which appears to be an intended use-case for the method.

Correct. The original idea behind this is to repeatedly run short-lived scripts and get results, but they might accumulate garbage. In between, when memory usage gets too high, trigger libv8 GC via low mem notification.

In that specific use case this fits the bill:

In particular, doing so would cause any rb-thread calling low_memory_notification to block until other threads using the isolate have unlocked it (for JavaScript execution, this means the script has finished running).

So it seems like in that case, which is the only one where mini_racer makes use of low_memory_notification, the following would be fine:

Normally I would simply slap a Locker guard { isolate_info->isolate } prior to the call

I guess the following bit of code (notably the @eval_thread check) was supposed to sort of ensure that on the Ruby side but it's not sufficient anymore and doesn't cater for whatever libv8 is doing internally:

if !@eval_thread && ensure_gc_after_idle_seconds < now - @last_eval
@ensure_gc_mutex.synchronize do

The two debug+release cases you described plus the lack of any other feature that would fit the bill seem to make it clear that v8 intents us to just use the lock guard, so let's do that.

from mini_racer.

lloeki avatar lloeki commented on August 17, 2024

I've done just that in ac520dd (#284), thanks a lot!

from mini_racer.

tisba avatar tisba commented on August 17, 2024

Not 100% sure if the original issue got 100% fixed, but it looks like it (in c195239), right, @lloeki?

from mini_racer.

tisba avatar tisba commented on August 17, 2024

Fixed/Addressed in c195239, released as v0.12.0

from mini_racer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.