tags:

views:

743

answers:

1

Not sure why I keep getting an OutOfMemory exception. I'm using ASP.NET MVC with LINQ to SQL. Here's some of the stack trace:

[OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.]
System.Runtime.CompilerServices.RuntimeHelpers._CompileMethod(IntPtr method) +0
System.Reflection.Emit.DynamicMethod.CreateDelegate(Type delegateType) +7652553
System.Data.Linq.SqlClient.ObjectReaderCompiler.Compile(SqlExpression expression, Type elementType) +442
System.Data.Linq.SqlClient.SqlProvider.GetReaderFactory(SqlNode node, Type elemType) +100
System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) +253
System.Data.Linq.Table1.System.Linq.IQueryProvider.Execute(Expression expression) +49
System.Linq.Queryable.Single(IQueryable
1 source, Expression`1 predicate) +301
WorkGrabber.Web.Models.WorkGrabberDataContext.GetJob(Int32 id) +233
WorkGrabber.Web.Controllers.BidsController.New(Int32 jobId) +19

A: 

What is your expression? The problem seems to stem from this line:

System.Reflection.Emit.DynamicMethod.CreateDelegate(Type delegateType) +7652553

That offset seems quite strange. I can hardly believe a normal dynamic method will have a 7.5MB body.

Franci Penov
WorkGrabber.Web.Models.WorkGrabberDataContext.GetJob(Int32 id) Thats just a datacontext.Jobs.Single(j=>j.JobID = id)Could it be from the LoadOptions or something? Where did you get the 7.5 MB body from?
From the call stack line, it shows that the error happens while at offset +7652553 from the beginning of the method call.
Franci Penov