[Mono-dev] Memory leak in DeflateStream

David Brown mono at davidb.org
Wed Jan 24 03:00:24 EST 2007


I've filed bug #80594 demonstrating a severe memory leak in
DeflateStream.  Since these streams aren't reusable, I haven't been
able to figure out any kind of workaround for this problem.  Any
ideas?

This program consumes unbounded memory very quickly (exhausting swap,
for example).

/* Demonstrate memory leak in DeflateStream. */

using System.IO;
using System.IO.Compression;

class MemoryLeak {
    static void Main () {
        while (true) {
            MemoryStream ms = new MemoryStream (new byte[65536]);
            DeflateStream zms = new DeflateStream (ms,
CompressionMode.Decompress);
            zms.Dispose ();
        }
    }
}




More information about the Mono-devel-list mailing list