Hello querdenker,I'm using the latest version.
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 check this on the scripts I have here to test, but i can't check every script, that is executed by the users.
- Is it possible that your scripts are generating increasing amounts of data that is reachable from the global/root object?
I had this idea before, but didn't implemted it yet. I give it a try.
- 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.
Thanks for your quick response and your hints.
- 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.