0

In my web application i want to show a table data in Data Grid for that i am using Entity Framework 4.0 while executing i am getting exception that out of memory.

Is there any limitation in ASP.NET Data Grid. I am using Oracle DataBase.

Below is my code

        Entities obj = new Entities();
        GridView1.DataSource = obj.EQUIPMENTs.ToList();
        //Here i am getting exception
        GridView1.DataBind();
2
  • Do you really need the .ToList()? Commented Apr 9, 2013 at 7:32
  • But still i am getting OutOfMemoryException Commented Apr 9, 2013 at 7:39

1 Answer 1

2

You have to check your memory consumption. Use a ProcessExplorer for easy check. If you are in limits, chech the amount of data you load into the collection.

Remember that CLR apart of the allocated RAM limitation has a limitation on LIst<T> size, I see obj.EQUIPMENTs.ToList(). For List<T>, limitation is 2GB (even on x64).

If one of these is true (or both), the solution is rearchitect your code.

Example:

It's hardly possible that your user need all that amount of data at once, may be you can slice it between different pages/tabs/whatever...

If you need some statistical information, some aggregation, or some calculation, do it on server and transfer only the results.

Sign up to request clarification or add additional context in comments.

4 Comments

If you are on 4.5 with 64bit, then you can increase the list size with <gcAllowVeryLargeObjects>.
But for Windows DataGridView it is hardly taking 2 min to dispaly all the records
@weismat: yes, but it's better do not do that. In 90% cases, there is other solution.
@Jagadesh: I have no any information about state of your apllicaiton. That's why I suggest you first check out memory and colleciton size you get, which can be and usually is a source of such kind of problems.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.