[Mono-list] [System.IO.Compression] OutOfMemory exception on DeflateStream instantiation

Generic 2006 generic2006 at libero.it
Tue Dec 5 18:20:47 EST 2006

Hi all

I'm crashing against an annoying issue, regarding the instantiation of
DeflateStream objects.
Here it is my simple code:

  MemoryStream outputStream = new MemoryStream();
  DeflateStream outputFilter = new DeflateStream(
    ); // OutOfMemory exception is thrown here.

I found a couple of bug reports about this [1], and I have also
inspected DeflateStream source code, but apparently without success.
The exception is thrown after an invocation to the underlying zlib:
    this.z_stream = create_z_stream (mode, gzip);
    if (z_stream == IntPtr.Zero) {
     throw new OutOfMemoryException ();
Someone suggests this is a misleading exception indicating that the zlib
version on the system is too old (<, but I have verified that
its version on my system (Debian sarge stable) is OK (1.2.2).

Do you have any suggestion, please?

[1] http://bugzilla.ximian.com/show_bug.cgi?id=79665

More information about the Mono-list mailing list