Avoiding memory bloat with non-external runtimes

Aperta
#60 1 commento 3 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
30/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
ruby
Ambito
tooling

Direzione di ricerca

Start with the ExecJS.compile and compiled-context call API described in the issue, then trace how non-external runtimes manage their contexts. Define the release lifecycle and behavior after release, including whether memory is reclaimed by MiniRacer. The issue does not name implementation files or tests, so those must be located before work can be scoped.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I have observed that when using miniracer with our precompile assets process memory can run away big time.

This is cause sprockets often bloats the heap and at the point execjs is called there are extra v8 contexts sitting around in a bloated heap that just is too big to run a GC cause so much is free in it.

Trouble is a v8 context can easily consume 100+MB of RSS.

I was wondering if we could add to execjs a concept of "OK, I am done with the context"

Once that is called, MiniRacer could release the v8 context and reclaim all the memory. This means that usage wise if you want to reclaim memory early you would do:

context = ExecJS.compile(source)
context.call("CoffeeScript.compile", "square = (x) -> x * x", bare: true)
context.release
context.call("X") => raises error cause context is done and poison at this point. 

Clearly implementation would be optional.

Thoughts ?

Lingua principale
Ruby
Stelle
581
Fork
285
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di rails/execjs

Tutte le issue di rails/execjs

Issue simili

Altre issue su Ruby

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.