Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Increasing memory during V8 usage

0
0
ClearScript wrote:
Hello querdenker,

It doesn't look like you're doing anything wrong. Can you say any more about the sort of work your scripts are doing?

Some general suggestions:‚Äč
  • Make sure you're using the latest version of ClearScript. A number of memory leaks have been fixed since the last point release.
I'm using the latest version.
  • Is it possible that your scripts are generating increasing amounts of data that is reachable from the global/root object?
I check this on the scripts I have here to test, but i can't check every script, that is executed by the users.
  • Try to avoid script compilation as much as possible. Consider using compiled scripts or direct invocation of script functions to re-execute script code.
  • We've found that when it comes to garbage collection, V8 is lazy to an extent that can get it in trouble. Consider invoking the garbage collector explicitly via ScriptEngine.CollectGarbage(true). Use a schedule that makes sense for your application - periodically or based on idle state, maximum invocation count, etc.
I had this idea before, but didn't implemted it yet. I give it a try.
  • If all else fails, consider disposing the script engine and spinning up a fresh instance once in a while - again, using a schedule that makes sense for you.
Good luck!
Thanks for your quick response and your hints.

Viewing all articles
Browse latest Browse all 2297