Rhino.Context.SetMaximumInterpreterStackDepth C# (CSharp) Method

SetMaximumInterpreterStackDepth() public method

Sets the maximum stack depth (in terms of number of call frames) allowed in a single invocation of interpreter.
Sets the maximum stack depth (in terms of number of call frames) allowed in a single invocation of interpreter. If the set depth would be exceeded, the interpreter will throw an EvaluatorException in the script. Defaults to Integer.MAX_VALUE. The setting only has effect for interpreted functions (those compiled with optimization level set to -1). As the interpreter doesn't use the Java stack but rather manages its own stack in the heap memory, a runaway recursion in interpreted code would eventually consume all available memory and cause OutOfMemoryError instead of a StackOverflowError limited to only a single thread. This setting helps prevent such situations.
/// if this context's optimization level is not /// -1 /// if the new depth is not at least 1
public SetMaximumInterpreterStackDepth ( int max ) : void
max int the new maximum interpreter stack depth
return void
		public void SetMaximumInterpreterStackDepth(int max)
		{
			if (@sealed)
			{
				OnSealedMutation();
			}
			if (optimizationLevel != -1)
			{
				throw new InvalidOperationException("Cannot set maximumInterpreterStackDepth when optimizationLevel != -1");
			}
			if (max < 1)
			{
				throw new ArgumentException("Cannot set maximumInterpreterStackDepth to less than 1");
			}
			maximumInterpreterStackDepth = max;
		}
Context