diff --git a/src/React.Core/IReactSiteConfiguration.cs b/src/React.Core/IReactSiteConfiguration.cs
index 9337db3c0..bd10fee0f 100644
--- a/src/React.Core/IReactSiteConfiguration.cs
+++ b/src/React.Core/IReactSiteConfiguration.cs
@@ -102,6 +102,17 @@ public interface IReactSiteConfiguration
///
IReactSiteConfiguration SetMaxEngines(int? maxEngines);
+ ///
+ /// Gets or sets the maximum number of times an engine can be reused before it is disposed.
+ /// 0 is unlimited. Defaults to 100.
+ ///
+ int? MaxUsagesPerEngine { get; set; }
+ ///
+ /// Sets the maximum number of times an engine can be reused before it is disposed.
+ /// 0 is unlimited. Defaults to 100.
+ ///
+ IReactSiteConfiguration SetMaxUsagesPerEngine(int? maxUsagesPerEngine);
+
///
/// Gets or sets whether the MSIE engine should be used if V8 is unavailable.
///
diff --git a/src/React.Core/JavaScriptEngineFactory.cs b/src/React.Core/JavaScriptEngineFactory.cs
index a15cf6d48..61d14f8de 100644
--- a/src/React.Core/JavaScriptEngineFactory.cs
+++ b/src/React.Core/JavaScriptEngineFactory.cs
@@ -100,6 +100,10 @@ protected virtual IJsPool CreatePool()
{
poolConfig.StartEngines = _config.StartEngines.Value;
}
+ if (_config.MaxUsagesPerEngine != null)
+ {
+ poolConfig.MaxUsagesPerEngine = _config.MaxUsagesPerEngine.Value;
+ }
var pool = new JsPool(poolConfig);
// Reset the recycle exception on recycle. If there *are* errors loading the scripts
diff --git a/src/React.Core/ReactSiteConfiguration.cs b/src/React.Core/ReactSiteConfiguration.cs
index 5fc057eec..bab2e5e23 100644
--- a/src/React.Core/ReactSiteConfiguration.cs
+++ b/src/React.Core/ReactSiteConfiguration.cs
@@ -191,6 +191,21 @@ public IReactSiteConfiguration SetMaxEngines(int? maxEngines)
return this;
}
+ ///
+ /// Gets or sets the maximum number of times an engine can be reused before it is disposed.
+ /// 0 is unlimited. Defaults to 100.
+ ///
+ public int? MaxUsagesPerEngine { get; set; }
+ ///
+ /// Sets the maximum number of times an engine can be reused before it is disposed.
+ /// 0 is unlimited. Defaults to 100.
+ ///
+ public IReactSiteConfiguration SetMaxUsagesPerEngine(int? maxUsagesPerEngine)
+ {
+ MaxUsagesPerEngine = maxUsagesPerEngine;
+ return this;
+ }
+
///
/// Gets or sets whether the MSIE engine should be used if V8 is unavailable.
///