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

New Post: MemoryLeak despite disposing of V8 Script Engines

0
0
I have at most 10-15 scripts active at a time. For each script, I create a separate V8Runtime and create an engine off of that. I compile the script, too. So for each script I have a Tuple<V8Runtime, V8Engine, V8Script>.

At first I did not create an explicit runtime and used the V8Engine constructor. But in an effort to solve this problem I added the explicit V8Runtime so that I could dispose of it explicitly.

So now, after a particular script receives 250 callbacks, I will completely dispose of the script, engine, and runtime, then build them back up again. I was hoping whatever was leaking would get cleaned up that way, but it didn't make any difference.

I could instead keep a pool of V8Runtimes and reuse them and see if that helps. But if I do that, I have a question. These are all long-running scripts, because they are waiting for a callback initiated by managed code. But I want each script to be isolated and not collide any globals between them. I also would like them to execute in parallel if possible -- because each one really has nothing to do with any of the others, so serializing execution of them would be silly and a possible bottleneck for me. So, the question is, if two V8Engines share the same V8Runtime, will they still be isolated from each other in that regard?

Viewing all articles
Browse latest Browse all 2297

Latest Images

Trending Articles





Latest Images