Skip to content

OutOfMemoryException #101

@viveknuna

Description

@viveknuna

I am using this library 1.2.2 version in my windows service app, sometimes It's giving the below error and my application crashes.

Am I doing something wrong here? Can I fix this in my code? I want to keep updating the library to the latest version as the last option as it's a stable service and running for years.

this is the place where it gives the exception.

var context = new ExpressionContext();

context.Variables["Prop1"] = _rateExpression.Prop1;
context.Variables["Prop2"] = _rateExpression.Prop2;
context.Variables["Prop3"] = _rateExpression.Prop3;
context.Variables["Prop4"] = _rateExpression.Prop4;
context.Variables["Prop5"] = _rateExpression.Prop5;
context.Variables["Prop6"] = _rateExpression.Prop6;
context.Variables["Prop7"] = _rateExpression.Prop7;
context.Variables["Prop8"] = _rateExpression.Prop8;

try
{
	return (decimal)context.CompileDynamic(_rateExpression.Formula).Evaluate();
}
catch (Exception ex)
{
}

2022-09-13 15:37:31,600 [ 33] ERROR [SUSIAALGCCWSXT1] - System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at Flee.Parsing.grammatica_1._5.alpha2.PerCederberg.Grammatica.Runtime.LookAheadSet.Sequence..ctor(Boolean repeat, Int32 token)
at Flee.Parsing.grammatica_1._5.alpha2.PerCederberg.Grammatica.Runtime.RecursiveDescentParser.FindLookAhead(ProductionPatternElement elem, Int32 length, Int32 dummy, CallStack stack, LookAheadSet filter)
at Flee.Parsing.grammatica_1._5.alpha2.PerCederberg.Grammatica.Runtime.RecursiveDescentParser.FindLookAhead(ProductionPatternElement elem, Int32 length, CallStack stack, LookAheadSet filter)
at Flee.Parsing.grammatica_1._5.alpha2.PerCederberg.Grammatica.Runtime.RecursiveDescentParser.FindLookAhead(ProductionPatternAlternative alt, Int32 length, Int32 pos, CallStack stack, LookAheadSet filter)
at Flee.Parsing.grammatica_1._5.alpha2.PerCederberg.Grammatica.Runtime.RecursiveDescentParser.FindLookAhead(ProductionPattern pattern, Int32 length, CallStack stack, LookAheadSet filter)
at Flee.Parsing.grammatica_1._5.alpha2.PerCederberg.Grammatica.Runtime.RecursiveDescentParser.FindLookAhead(ProductionPatternElement elem, Int32 length, Int32 dummy, CallStack stack, LookAheadSet filter)
at Flee.Parsing.grammatica_1._5.alpha2.PerCederberg.Grammatica.Runtime.RecursiveDescentParser.FindLookAhead(ProductionPatternElement elem, Int32 length, CallStack stack, LookAheadSet filter)
at Flee.Parsing.grammatica_1._5.alpha2.PerCederberg.Grammatica.Runtime.RecursiveDescentParser.FindLookAhead(ProductionPatternAlternative alt, Int32 length, Int32 pos, CallStack stack, LookAheadSet filter)
at Flee.Parsing.grammatica_1._5.alpha2.PerCederberg.Grammatica.Runtime.RecursiveDescentParser.FindLookAhead(ProductionPattern pattern, Int32 length, CallStack stack, LookAheadSet filter)
at Flee.Parsing.grammatica_1._5.alpha2.PerCederberg.Grammatica.Runtime.RecursiveDescentParser.FindLookAhead(ProductionPatternElement elem, Int32 length, Int32 dummy, CallStack stack, LookAheadSet filter)
at Flee.Parsing.grammatica_1._5.alpha2.PerCederberg.Grammatica.Runtime.RecursiveDescentParser.FindLookAhead(ProductionPatternElement elem, Int32 length, CallStack stack, LookAheadSet filter)
at Flee.Parsing.grammatica_1._5.alpha2.PerCederberg.Grammatica.Runtime.RecursiveDescentParser.FindLookAhead(ProductionPatternAlternative alt, Int32 length, Int32 pos, CallStack stack, LookAheadSet filter)
at Flee.Parsing.grammatica_1._5.alpha2.PerCederberg.Grammatica.Runtime.RecursiveDescentParser.FindLookAhead(ProductionPattern pattern, Int32 length, CallStack stack, LookAheadSet filter)
at Flee.Parsing.grammatica_1._5.alpha2.PerCederberg.Grammatica.Runtime.RecursiveDescentParser.FindLookAhead(ProductionPatternElement elem, Int32 length, Int32 dummy, CallStack stack, LookAheadSet filter)
at Flee.Parsing.grammatica_1._5.alpha2.PerCederberg.Grammatica.Runtime.RecursiveDescentParser.FindLookAhead(ProductionPatternElement elem, Int32 length, CallStack stack, LookAheadSet filter)
at Flee.Parsing.grammatica_1._5.alpha2.PerCederberg.Grammatica.Runtime.RecursiveDescentParser.FindLookAhead(ProductionPatternAlternative alt, Int32 length, Int32 pos, CallStack stack, LookAheadSet filter)
at Flee.Parsing.grammatica_1._5.alpha2.PerCederberg.Grammatica.Runtime.RecursiveDescentParser.FindLookAhead(ProductionPattern pattern, Int32 length, CallStack stack, LookAheadSet filter)
at Flee.Parsing.grammatica_1._5.alpha2.PerCederberg.Grammatica.Runtime.RecursiveDescentParser.FindLookAhead(ProductionPatternElement elem, Int32 length, Int32 dummy, CallStack stack, LookAheadSet filter)
at Flee.Parsing.grammatica_1._5.alpha2.PerCederberg.Grammatica.Runtime.RecursiveDescentParser.FindLookAhead(ProductionPatternElement elem, Int32 length, CallStack stack, LookAheadSet filter)
at Flee.Parsing.grammatica_1._5.alpha2.PerCederberg.Grammatica.Runtime.RecursiveDescentParser.FindLookAhead(ProductionPatternAlternative alt, Int32 length, Int32 pos, CallStack stack, LookAheadSet filter)
at Flee.Parsing.grammatica_1._5.alpha2.PerCederberg.Grammatica.Runtime.RecursiveDescentParser.CalculateLookAhead(ProductionPatternAlternative alt, Int32 pos)
at Flee.Parsing.grammatica_1._5.alpha2.PerCederberg.Grammatica.Runtime.RecursiveDescentParser.CalculateLookAhead(ProductionPattern pattern)
at Flee.Parsing.grammatica_1._5.alpha2.PerCederberg.Grammatica.Runtime.RecursiveDescentParser.Prepare()
at Flee.Parsing.grammatica_1._5.alpha2.PerCederberg.Grammatica.Runtime.Parser.Parse()
at Flee.PublicTypes.ExpressionContext.DoParse()
at Flee.PublicTypes.ExpressionContext.Parse(String expression, IServiceProvider services)
at Flee.InternalTypes.Expression1.Compile(String expression, ExpressionOptions options) at Flee.InternalTypes.Expression1..ctor(String expression, ExpressionContext context, Boolean isGeneric)
at FxRateCalculationLib.Common.RateExpressionEvaluator.Evaluate()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions