views:

243

answers:

1

I am processing XML coming from server which contains both images and data in one C# function (compiled 32 bit). When I try to parse this xml in memory it gives me System.OutOfMemory exception.

Is there any way to avoid this error?

My guess is, system cannot find contiguous block of 50-100MB memory. (my pc hv 8Gig ram and its quad core)

+2  A: 

An XML file that is 50-100 MB on disk is going to be a lot larger when parsed into a DOM. (Assuming of course that you're using XmlDocument or XDocument.)

Although I despise the API, you may want to look into using XmlReader to "stream" the document in. It will be much more performant than using the DOM but it's a lot less intuitive to use.

Josh Einstein