title: "Out of Memory" Exception when Decrypting an XML file
body: <p>I'm using the System.Security.Cryptography library to encrypt and decrypt xml files. Recently though I've been getting OOM (Out of Memory) exceptions while trying to decrypt a 75MB file. Here's the code I'm using:    </p>
  
  <pre><code>    using System.Security.Cryptography.Xml;
      ...
      public static XmlDocument DecryptIntoXmlDoc(string filename)
      {
          //Decrypt the XML
          XmlDocument xmldoc = new XmlDocument();
          EncryptedXml exml = new EncryptedXml(xmldoc);
          TripleDESCryptoServiceProvider ekey = new TripleDESCryptoServiceProvider();
          ASCIIEncoding encoding = new ASCIIEncoding();
  
          ekey.Key = encoding.GetBytes(GetMasterKey());
          exml.AddKeyNameMapping("ekey", ekey);
          xmldoc.Load(filename);
  
          // -- THROWS THE OOM ERROR --
          exml.DecryptDocument();
  
          //Clear exml
          exml = null;
  
          return xmldoc;
      }
  </code></pre>
  
  <p>As soon as .DecryptDocument() is called I get the following error:</p>
  
  <pre><code> Exception of type 'System.OutOfMemoryException' was thrown.
  </code></pre>
  
  <p>I haven't been able to find anyone else having this problem, but I have read that if the xml tags aren't properly named/nested, the file can be very large when loaded into memory. 
  Would renaming my XML tags to shorter names reduce the size? Is there a way to nest xml tags to reduce the file size?</p>
  
  <p>Is there anything else I could do?</p>