开发者

Large data processing in x86 C# gives System.OutOfMemory exception

开发者 https://www.devze.com 2022-12-26 20:31 出处:网络
I am processing XML coming from server which contains both images and data in one C# function (compiled 32 bit).

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 co开发者_StackOverflow中文版ntiguous block of 50-100MB memory. (my pc hv 8Gig ram and its quad core)


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消