【发布时间】:2016-07-26 17:14:01
【问题描述】:
机器配置为 4CPU 16 GB RAM 并尝试处理 800MB 和 300MB XML 文件。有时 .NET Saxon API 会在堆栈跟踪下方抛出内存不足异常。查看了前几个小时的 perfstats,服务器似乎有 10GB 的可用内存。下面的代码是使用 Task.Run() 在并行任务中运行的,请告知。
DocumentBuilder documentBuilder = processor.NewDocumentBuilder();
documentBuilder.IsLineNumbering = true;
documentBuilder.WhitespacePolicy = WhitespacePolicy.PreserveAll;
XdmNode _XdmNode = documentBuilder.Build(xmlDocumentToEvaluate);
System.Exception: Error in ExecuteRules method ---> System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at net.sf.saxon.tree.tiny.TinyTree.condense(Statistics )
at net.sf.saxon.tree.tiny.TinyBuilder.close()
at net.sf.saxon.event.ProxyReceiver.close()
at net.sf.saxon.pull.PullPushCopier.copy()
at net.sf.saxon.event.Sender.sendPullSource(PullSource , Receiver , ParseOptions )
at net.sf.saxon.event.Sender.send(Source source, Receiver receiver, ParseOptions options)
at net.sf.saxon.Configuration.buildDocument(Source source, ParseOptions parseOptions)
at net.sf.saxon.Configuration.buildDocument(Source source)
at Saxon.Api.DocumentBuilder.Build(XmlReader reader)
at Saxon.Api.DocumentBuilder.Build(XmlNode source)
【问题讨论】:
-
没有。如果 Saxon API 有任何建议,我仍在调查并寻求帮助。
-
如果应用程序在 64 位机器上以 32 位运行,SAXON API 是否会导致大文件的内存不足异常...