即使30 GB内存空闲,也没有足够的内存异常 [英] Insufficient memory exception even if 30 GB memory is free
本文介绍了即使30 GB内存空闲,也没有足够的内存异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个消耗大量内存的程序(x64)。我在win server 2008 R2 SP1上运行它,内存为48 GB(64位).net框架工作4.5
我还在app.config中设置了gcAllowVeryLargeObjects = true 。
当我运行该程序时,它消耗18 GB内存之后它会给出异常
EXCEPTION:
System.OutOfMemoryException:内存不足,继续执行程序。
在System.Text.StringBuilder.ExpandByABlock( Int32 minBlockCharCount)
在System.Text.StringBuilder.Append(Char * value , Int32 valueCount)
at System.Text.StringBuilder.Append( String value )
at System.Xml.XmlTextEncoder.Write( String 文本)
at System.Xml.XmlTextWriter.WriteWhitespace( String ws)
at System.Xml.XmlElement.WriteElementTo(XmlWriter writer,XmlElement e) )System.Seml.Cryptography.Xml.Utils.PreProcessElementInput中的System.Xml.XmlNode.get_OuterXml()
(XmlElement e
lem,XmlResolver xmlResolver, String baseUri)
at System.Security.Cryptography.Xml.Reference.CalculateHashValue(XmlDocument
document,CanonicalX mlNodeList refList)
at System.Security.Cryptography.Xml.SignedXml.BuildDigestedReferences()
at System.Security.Cryptography.Xml.SignedXml.ComputeSignature()
它提供内存不足,但我们仍然可以免费使用30 GB内存。是.net应用程序的限制或服务器给我这个错误。
解决方案
如果你签署一个18GB的xml,你肯定做错了。 />
如果有必要,可以尝试用小件做东西。
Xml加密库不适用于此类usecases。
I have a program(x64) that consumes a large amount of memory. I am running it on win server 2008 R2 SP1 with 48 GB RAM(64 bit) .net frame work 4.5
I have also set gcAllowVeryLargeObjects = true in app.config.
When i run the program it consumes 18 GB memory after that it gives exception
EXCEPTION:
System.OutOfMemoryException: Insufficient memory to continue the execution of the program.
at System.Text.StringBuilder.ExpandByABlock(Int32 minBlockCharCount)
at System.Text.StringBuilder.Append(Char* value, Int32 valueCount)
at System.Text.StringBuilder.Append(String value)
at System.Xml.XmlTextEncoder.Write(String text)
at System.Xml.XmlTextWriter.WriteWhitespace(String ws)
at System.Xml.XmlElement.WriteElementTo(XmlWriter writer, XmlElement e)
at System.Xml.XmlNode.get_OuterXml()
at System.Security.Cryptography.Xml.Utils.PreProcessElementInput(XmlElement e
lem, XmlResolver xmlResolver, String baseUri)
at System.Security.Cryptography.Xml.Reference.CalculateHashValue(XmlDocument
document, CanonicalXmlNodeList refList)
at System.Security.Cryptography.Xml.SignedXml.BuildDigestedReferences()
at System.Security.Cryptography.Xml.SignedXml.ComputeSignature()
Its giving the "Insufficient memory" however we still have 30 GB memory free . Is it the limit of .net application or the server that giving me this error.
解决方案
You are definitely doing something wrong if you are signing a 18gb xml.
Try doing things in smaller pieces if it is necessary.
The Xml cryptography library is not designed for such usecases.
这篇关于即使30 GB内存空闲,也没有足够的内存异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文