機器配置爲4CPU 16 GB RAM,並嘗試處理800MB和300MB XML文件。 .NET Saxon API有時會在堆棧跟蹤下拋出內存異常。看着前幾個小時的perfstats,服務器似乎有10GB的空閒內存。下面的代碼使用Task.Run()在並行任務中運行請指教。C#.Net SaxonApi拋出內存異常
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)
不,我仍在調查並尋求一些幫助,如果撒克遜API有任何建議。 –
如果應用程序在64位計算機上以32位運行,SAXON API會導致大文件的內存不足異常... –