3

I've got this the simplest query ever in my LINQPad:

var xml = XElement.Load(@"C:\\Users\\myth\sample.xml");
var query =
    from e in xml.Elements()
    select e;
query.Dump();

The problem is that it gives me back System.OutOfMemoryException. XML file is around 120MB.
I've read it here that LINQPad has a limitation of returning only 10000 rows.

So, then I've tried putting it like this

var query =
    (from e in xml.Elements()
    select e).Take(100);
query.Dump();

yet it gave me back the same error.

LINQPad version: v4.45.05

Community
  • 1
  • 1
IgnasK
  • 384
  • 2
  • 19
  • I put your code in against an XML file I created that is 168MB. It returns the first 1000 items without a problem. Are you outputting to grid or rich text? When I changed to grid I also got an out of memory exception. Perhaps this http://stackoverflow.com/questions/5838657/how-can-i-use-linq-to-xml-to-query-huge-xml-files-with-reasonable-memory-consump will give you a different way that may work you? – Andy Robinson Aug 28 '13 at 11:01

1 Answers1

6

Figured it out by myself.

When you are dealing with huge XML files (>100MB) or any other massive queries whatsoever, you need to have X64 Build installed.

IgnasK
  • 384
  • 2
  • 19