title: log4net memoryappender Out of memory
body: <p>I'm using log4net with an memoryappender.
  When I try to read all the lines to an variable (here: StringBuilder) I'm getting an OutOfMemory-Exception when the amount of lines is to high. I've tested it with 1mio lines:</p>
  
  <pre><code>public class RenderingMemoryAppender : MemoryAppender
  {
      public IEnumerable&lt;string&gt; GetRenderedEvents(List&lt;Level&gt; levelList = null)
      {
          foreach (var loggingEvent in GetEvents())
          {
              yield return RenderLoggingEvent(loggingEvent);
          }
      }
  
      public byte[] GetEventsAsByteArray(List&lt;Level&gt; levelList=null )
      {
          var events = GetRenderedEvents(levelList);
          var s = new StringBuilder();
          foreach (var e in events)
          {
              s.Append(e);
          }
          //the exception is thrown here below when calling s.ToString().
          return Encoding.UTF8.GetBytes(s.ToString());
      }
  }
  </code></pre>
  
  <p>when I simply add one-million lines to an stringbuilder without the log4net component everything works fine...</p>
  
  <p>I've also tried to use this: </p>
  
  <pre><code>var stringBuilder = new StringBuilder();
  var stringWriter = new StringWriter(stringBuilder);
  
  foreach (var loggingEvent in GetEvents())
  {
      stringBuilder.Clear();
      loggingEvent.WriteRenderedMessage(stringWriter);
  
      list.Add(stringBuilder.ToString());
  }
  </code></pre>
  
  <p>but this also didn't work.</p>