Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-03-30 23:37:50


George M. Garner Jr. wrote:
> Johnathan,
>
> I'm getting a memory leak when using the gzip_decompressor due to a
> failure to call inflateEnd/deflateEnd during object destruction. I
> have inserted the following line into zlib.cpp tp correct the problem:
>
> void zlib_base::reset(bool compress)
> {
> z_stream* s = static_cast<z_stream*>(stream_);
> zlib_error::check(compress ? deflateReset(s) : inflateReset(s));
> zlib_error::check(compress ? deflateEnd(s) : inflateEnd(s)); // gmg
> cleanup stream->state and embedded pointers
> }
>
> There may be a better place for this, for example in the zlib
> destructor, since it may be desirable on occasion to reset a stream
> without destroying the state (??). Or perhaps there should be a new
> function to encapsulate
> the call to deflateEnd/inflateEnd which is called in the destructor.

Thanks. I'll fix this as soon as I have a chance.

Jonathan


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk