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

Commented Issue: Continuous Allocation of V8ScriptEngine Can Crash Application [106]

0
0
When allocating a V8ScriptEngine objects within a loop causes memory to remain allocated even if you force all references to the object to null and eventually crashes the application with a System.AccessViolationException. The details of the crash is below.

_Currently coding against version 5.4.5.0 of ClearScript._

__This Code Snippet Fails (Normally at iteration 134 the failure occurs)__
for (int i = 1; i <= 1000; i++)
{
var v8Engine = new Microsoft.ClearScript.V8ScriptEngine();
v8Engine = null;
}

__This Code Snippet Works:__
for (int i = 1; i <= 1000; i++)
{
var v8Engine = new Microsoft.ClearScript.V8ScriptEngine();
v8Engine = null;
//Invoking Garbage Collection Every 50 V8ScriptEngine object allocated
//Fixes the issue
if(i%50 == 0)
GC.Collect();
}

__Here are the details of the crash:__
Problem signature:
Problem Event Name: CLR20r3
Problem Signature 01: ClearScriptDemo.exe
Problem Signature 02: 1.0.0.0
Problem Signature 03: 572a5c94
Problem Signature 04: ClearScriptV8-32
Problem Signature 05: 5.4.5.0
Problem Signature 06: 56e184c1
Problem Signature 07: e6
Problem Signature 08: 78
Problem Signature 09: System.AccessViolationException
OS Version: 6.1.7601.2.1.0.256.4
Locale ID: 1033
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789

Comments: _Using SysInternals ProcessExplorer I captured some screen shots of the performance metrics of my test application. The images are attached in a zipped file (V8 Engine Allocation Investigation.Zip). Below is a breakdown of the images in the zip file._ _Please let me know if there is any more information that I need to provide._ __Set of Images showing performance profile when disposing of V8Runtime every 50 allocations/deallocation operations of V8ScriptEngine__ *Image 1: Allocation and Deallocation of 1000 V8ScriptEngines with Dispose of V8Runtime very 50 allocations.png *Image 2: Allocation and Deallocation of 1000 V8ScriptEngines with Dispose of V8Runtime very 50 allocations (Process Details).png *Image 3: Allocation and Deallocation of 1000 V8ScriptEngines with Dispose of V8Runtime very 50 allocations (.NET CLR Memory Details) __Set of Images showing performance profile when NOT disposing of V8Runtime every 50 allocations/deallocation operations of V8ScriptEngine__ *Image 4: Allocation and Deallocation of 1000 V8ScriptEngines WITHOUT Dispose of V8Runtime very 50 allocations.png *Image 5: Allocation and Deallocation of 1000 V8ScriptEngines WITHOUT Dispose of V8Runtime very 50 allocations (Process Details).png *Image 6: Allocation and Deallocation of 1000 V8ScriptEngines WITHOUT Dispose of V8Runtime very 50 allocations (.NET CLR Memory Details) __Code Snippet ran when capturing performance metrics.__ private void AllocateV8Engines() { V8ScriptEngine v8Engine = null; V8Runtime _v8Runtime = new V8Runtime(); try { for (int i = 1; i <= 1000; i++) { v8Engine = _v8Runtime.CreateScriptEngine(); v8Engine.Dispose(); //chkDisposeRuntime is a Checkbox control is used to determine //whether to dipose of V8Runtime or not. if (chkDisposeRuntime.Checked && i%50 == 0) { _v8Runtime.Dispose(); _v8Runtime = new V8Runtime(); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }

Viewing all articles
Browse latest Browse all 2297

Latest Images

Trending Articles





Latest Images