none
OutOfMemoryException was thrown at System.String.GetStringForStringBuilder RRS feed

  • Question

  • OutOfMemoryException' was thrown   at System.String.GetStringForStringBuilder using .Net 3.5.

    This exception did not occur in .Net 1.1 using the same amount of data.

    What happened?  There are posts all over the Internet about this exception and I've read several of them, but no luck.

    Is there a Microsoft patch that fixes this problem?

    Wednesday, November 30, 2011 1:01 AM

Answers

  • Apparently it's not just a problem with GetStringForStringBuilder......

    Message: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
           at System.IO.MemoryStream.set_Capacity(Int32 value)
           at System.IO.MemoryStream.EnsureCapacity(Int32 value)
           at System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count)
           at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
           at System.IO.StreamWriter.Write(String value)
           at System.Xml.XmlTextEncoder.Write(String text)
           at System.Xml.XmlTextWriter.WriteString(String text)

    • Marked as answer by wallyh010 Wednesday, November 30, 2011 3:15 AM
    Wednesday, November 30, 2011 1:34 AM

All replies

  • Apparently it's not just a problem with GetStringForStringBuilder......

    Message: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
           at System.IO.MemoryStream.set_Capacity(Int32 value)
           at System.IO.MemoryStream.EnsureCapacity(Int32 value)
           at System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count)
           at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
           at System.IO.StreamWriter.Write(String value)
           at System.Xml.XmlTextEncoder.Write(String text)
           at System.Xml.XmlTextWriter.WriteString(String text)

    • Marked as answer by wallyh010 Wednesday, November 30, 2011 3:15 AM
    Wednesday, November 30, 2011 1:34 AM
  • Hi wallyh010,

    Welcome to the MSDN forum.

    Could you please provide some code snippet that helps us to reproduce this issue?

    We are able to give a better response if we get the code.

    Thanks for your posting and understanding.

    Have a nice day.


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Wednesday, November 30, 2011 4:59 AM
  • Hello,

    I am facing similar issue when i getting files from secure server.

    IEnumerable<Renci.SshNet.Sftp.SftpFile> myfileList = oClientIn.ListDirectory("./")this code will be excute continously and i m getting that issue at some part of time but its not coming again. But i wanted to resolve it. pls help me

      at System.IO.MemoryStream.set_Capacity(Int32 value)
           at System.IO.MemoryStream.EnsureCapacity(Int32 value)
           at System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count)
           at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
           at System.IO.StreamWriter.Write(String value)
    Tuesday, October 8, 2013 3:30 PM