Out of Memory exception.

Posted by Community Admin on 04-Aug-2018 18:17

Out of Memory exception.

All Replies

Posted by Community Admin on 18-Mar-2015 00:00

We have three environments.  I did a small change where I added validation to a form field.  The validation was custom using a regex in question: ^[a-zA-Z0-9_,. ]*$

 

This fix worked fine in my local environment, dev, and stage.  It blew up in prod.

 

Stack trace:

Server Error in '/' Application. 

Exception of type 'System.OutOfMemoryException' was thrown. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown. 
Source Error: 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: 

[OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.] 

 Go7650(RegexRunner ) +0 
 System.Text.RegularExpressions.CompiledRegexRunner.Go() +12 
 System.Text.RegularExpressions.RegexRunner.Scan(Regex regex, String text, Int32 textbeg, Int32 textend, Int32 textstart, Int32 prevle System.Text.RegularExpressions.Regex.Run(Boolean quick, Int32 prevlen, String input, Int32 beginning, Int32 length, Int32 startat) +2 
 System.Text.RegularExpressions.Regex.Match(String input, Int32 startat) +25 
 System.Text.RegularExpressions.RegexReplacement.Replace(MatchEvaluator evaluator, Regex regex, String input, Int32 count, Int32 start System.Text.RegularExpressions.Regex.Replace(String input, MatchEvaluator evaluator, Int32 count, Int32 startat) +27 
 System.Text.RegularExpressions.Regex.Replace(String input, MatchEvaluator evaluator) +46 
 Telerik.Sitefinity.Web.UI.FieldListView.GetFormattedText() +99 
 Telerik.Sitefinity.Web.UI.FieldListView.OnDataBinding(EventArgs e) +268 
 System.Web.UI.WebControls.Repeater.DataBind() +77 
 System.Web.UI.Control.DataBindChildren() +173 
 System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +158 
 System.Web.UI.Control.DataBind() +15 
 Telerik.Web.UI.RadListView.BuildDataItem(Int32 itemsCreatedCount, Control itemContainer, Boolean dataBinding, Object dataItem, Int32& Telerik.Web.UI.RadListView.CreateDataItems(Control container, IEnumerable dataSource, Boolean dataBinding) +348 
 Telerik.Web.UI.RadListView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +811 
 Telerik.Web.UI.RadListView.PerformDataBinding(IEnumerable data) +49 
 System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +123 
 System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +29 
 System.Web.UI.WebControls.DataBoundControl.PerformSelect() +141 
 Telerik.Web.UI.RadListView.PerformSelect() +25 
 System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +71 
 Telerik.Web.UI.RadListView.DataBind() +40 
 Telerik.Web.UI.RadListView.AutoDataBind(RadListViewRebindReason rebindReason) +124 
 Telerik.Web.UI.RadListView.OnLoad(EventArgs e) +180 
 System.Web.UI.Control.LoadRecursive() +87 
 System.Web.UI.Control.LoadRecursive() +153 
 System.Web.UI.Control.LoadRecursive() +153 
 System.Web.UI.Control.AddedControl(Control control, Int32 index) +492 
 System.Web.UI.ControlCollection.Add(Control child) +157 
 Telerik.Sitefinity.Web.UI.SimpleView.CreateChildControls() +85 
 System.Web.UI.Control.EnsureChildControls() +119 
 System.Web.UI.Control.PreRenderRecursiveInternal() +63 
  System.Web.UI.Control.PreRenderRecursiveInternal() +203 System.Web.UI.Control.PreRenderRecursiveInternal() +203 System.Web.UI.Control.PreRenderRecursiveInternal() +203 System.Web.UI.Control.PreRenderRecursiveInternal() +203 System.Web.UI.Control.PreRenderRecursiveInternal() +203 System.Web.UI.Control.PreRenderRecursiveInternal() +203 System.Web.UI.Control.PreRenderRecursiveInternal() +203 System.Web.UI.Control.PreRenderRecursiveInternal() +203 
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3324 

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34212 

At this point I have backed out the change but I am not sure why this is happening.

Posted by Community Admin on 21-Mar-2015 00:00
Hello,

The problem is not very likely to be caused by the regular expression as it will not cause memory utilization just for the pattern matching of the regular expression. I have tested this scenario where a form control have a regular expression and this doesn`t cause any memory leak.

For System.OutOfMemoryException to be thrown there must be a problem caused by for example a lot of custom control which query large amounts of data like images/videos/documents and the big queries are retained in memory rather than having small queries for example of 20 items and involving paging if those files are displayed to the user.

To better determine the cause of the exception and narrow it down to a single control on a page I suggest performing a small test scenario outlined in this KB article.

Please let me know the version of the Sitefinity site that experience the System.OutOfMemoryException?

Regards,
Stanislav Velikov
Telerik
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 
This thread is closed