Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoiding memory bloat with non-external runtimes #60

Open
SamSaffron opened this issue Mar 10, 2017 · 1 comment
Open

Avoiding memory bloat with non-external runtimes #60

SamSaffron opened this issue Mar 10, 2017 · 1 comment

Comments

@SamSaffron
Copy link
Contributor

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 ?

@rafaelfranca
Copy link
Member

👍 for the idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants