Skip to content

Commit 47cca0d

Browse files
committed
In JavaScriptEngineSwitcher.ChakraCore in configuration settings of the ChakraCore JS engine was added one new property - MemoryLimit
1 parent 7ebe922 commit 47cca0d

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

NuGet/JavaScriptEngineSwitcher.ChakraCore/JavaScriptEngineSwitcher.ChakraCore.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ This package does not contain the native implementations of ChakraCore. Therefor
2020
* JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64
2121
* JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64</description>
2222
<summary>JavaScriptEngineSwitcher.ChakraCore contains adapter `ChakraCoreJsEngine` (wrapper for the ChakraCore).</summary>
23-
<releaseNotes>Fixed a error, that occurred during finding the suitable method overload, that receives numeric values and interfaces as parameters, of the host object.</releaseNotes>
23+
<releaseNotes>In configuration settings of the ChakraCore JS engine was added one new property - `MemoryLimit`.</releaseNotes>
2424
<copyright>Copyright (c) 2013-2017 Andrey Taritsyn - http://www.taritsyn.ru</copyright>
2525
<language>en-US</language>
2626
<tags>JavaScriptEngineSwitcher JavaScript ECMAScript ChakraCore</tags>

NuGet/JavaScriptEngineSwitcher.ChakraCore/readme.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
=============
3131
RELEASE NOTES
3232
=============
33-
Fixed a error, that occurred during finding the suitable method overload, that
34-
receives numeric values and interfaces as parameters, of the host object.
33+
In configuration settings of the ChakraCore JS engine was added one new
34+
property - `MemoryLimit`.
3535

3636
=============
3737
DOCUMENTATION

src/JavaScriptEngineSwitcher.ChakraCore/ChakraCoreJsEngine.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ public ChakraCoreJsEngine(ChakraCoreSettings settings)
137137
try
138138
{
139139
_jsRuntime = JsRuntime.Create(attributes, null);
140+
_jsRuntime.MemoryLimit = settings.MemoryLimit;
141+
140142
_jsContext = _jsRuntime.CreateContext();
141143
_jsContext.AddRef();
142144
}

src/JavaScriptEngineSwitcher.ChakraCore/ChakraCoreSettings.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
namespace JavaScriptEngineSwitcher.ChakraCore
1+
using System;
2+
3+
using JavaScriptEngineSwitcher.Core.Utilities;
4+
5+
namespace JavaScriptEngineSwitcher.ChakraCore
26
{
37
/// <summary>
48
/// Settings of the ChakraCore JS engine
@@ -42,6 +46,15 @@ public bool EnableExperimentalFeatures
4246
set;
4347
}
4448

49+
/// <summary>
50+
/// Gets or sets a current memory limit for a runtime in bytes
51+
/// </summary>
52+
public UIntPtr MemoryLimit
53+
{
54+
get;
55+
set;
56+
}
57+
4558

4659
/// <summary>
4760
/// Constructs an instance of the ChakraCore settings
@@ -52,6 +65,8 @@ public ChakraCoreSettings()
5265
DisableNativeCodeGeneration = false;
5366
DisableEval = false;
5467
EnableExperimentalFeatures = false;
68+
MemoryLimit = Utils.Is64BitProcess() ?
69+
new UIntPtr(ulong.MaxValue) : new UIntPtr(uint.MaxValue);
5570
}
5671
}
5772
}

0 commit comments

Comments
 (0)