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

Commented Unassigned: Fatal error in heap setup, Allocation failed - process out of memory [44]

$
0
0
Hi,

While investigating some memory related issues in my application, I managed to reproduce what seems to be a problem. The following minimal application terminates on my PC after ~50 cycles and prints the following to console:

```
#
# Fatal error in heap setup
# Allocation failed - process out of memory
#
```

```
class Program
{
static void Main(string[] args)
{
for (int i = 0; i < 1000; i++)
{
using (V8ScriptEngine engine = new V8ScriptEngine())
{
Console.WriteLine("Created engine #{0}", i);
engine.Execute("function zz(){}");
var tmp = engine.Evaluate("zz");
}
}
}
}
```


Strangely, the memory usage doesn't seem high when it terminates.

I used both a Nuget package, and a manually built latest ClearScript + V8 with same results.

Any help will be greatly appreciated.
Thanks in advance again,
Ron

Comments: Hi, Thanks, your dispose addition resolves this problem! However, I think that in a realistic scenario it would not always be possible to dispose the script object at that time. Why isn't the script item disposed automatically when its engine/runtime is disposed? Surely it can't be used after that time. I also don't fully understand the problem. You wrote that "V8 reserves a large block of address space __for each one"__ but I'm creating a new engine each time. Does V8 keep a global block for all instances? I verified that I can create more than 50 script items per engine, so where exactly is this ~50 limit? I think it would be great if ClearScript would automatically take care of disposing all engine resources once the engine is disposed, especially for server scenarios where new engines may be created frequently. Thanks again, Ron

Viewing all articles
Browse latest Browse all 2297

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>