Out of memory, even if 30 GB of free memory

I have a program (x64) that consumes a lot of memory. I run it on win server 2008 R2 SP1using 48 GB RAM(64 bit), .net frame work 4.5.

I also installed gcAllowVeryLargeObjects = truein app.config.

When I run the program, it consumes 18 GB of memory, after which it gives an 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()

It gives "Out of memory", however we still do not have 30 GB free memory. Is this the limit of a .net application or a server that gives me this error.

+4
source share
2 answers

StringBuilder, int.MaxValue . .NET, gcAllowVeryLargeObjects , . , int , .

. StreamWriter StringWriter. , .

RAM-, . .

+3

, , .

, BCL List<T>, , 32 64. 2GB .

, List<T>, .

, .

0

All Articles