Last post Jul 13, 2010 07:07 AM by goncalomarcos
Jul 08, 2010 09:48 AM|goncalomarcos|LINK
I'm in a project and we're using .net 4 dynamic data and entity framework. When we try to load a specific table to a grid in the dynamic data site, we get the following error:
Server Error in '/Admin' 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.
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.
[OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.]
System.Convert.ToBase64String(Byte inArray, Int32 offset, Int32 length, Base64FormattingOptions options) +122
System.Web.UI.ObjectStateFormatter.Serialize(Object stateGraph) +189
System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Serialize(Object state) +4
System.Web.UI.Util.SerializeWithAssert(IStateFormatter formatter, Object stateGraph) +37
System.Web.UI.Page.SavePageStateToPersistenceMedium(Object state) +108
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2839
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
This happens almost everytime we try to load that specific table. The table has 375000 records and about 20 columns. We don't think this to be significant to provoke the error. Are Out of Memory Exceptions a known issue in dynamic data or entity framework?
Thanks in advance,
.NET Framework 4.0
Jul 11, 2010 10:05 PM|Wencui Qian - MSFT|LINK
As I know, there's no such issues in dynamic data or entity framework. As to the memory leaking issues, I suggest you to check it following these guidelines.
1) Check out the source code and ensure you've closed the connection and disposed the objects correctly.
2) Check out the code, and see whether there's some improper loops which cost the resources.
3) Also, incorrect usage of string variables may cause memory troubles. For large string handling, it's recommended to use StringBuilder.
4) If you're experienced, you can use some professional debug tools e.g windbg to resolve this kind of problem. You can find memory leaking related debugging articles from Tess's blog. Here's the link:
Jul 13, 2010 07:07 AM|goncalomarcos|LINK
Hi! Thanks for the help but we already found the problem. The problem was that we used the DynamicData's FilterRepeater and that made the site EXTREMELY slow and memory consuming. The solution was found here
Everything works great now!