]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: compression: correctly report zlib_mem
authorWilly Tarreau <w@1wt.eu>
Wed, 24 Dec 2014 17:07:55 +0000 (18:07 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 24 Dec 2014 17:19:50 +0000 (18:19 +0100)
commit4f31fc2f28f09cb1bcd27af3367ee5acea29b656
treecca01daac44da1b9c7cc0ec3f8816f53c98decf7
parent529c13933b1007cf75d38140f569e6f5e2c99e78
BUG/MEDIUM: compression: correctly report zlib_mem

In zlib we track memory usage. The problem is that the way alloc_zlib()
and free_zlib() account for memory is different, resulting in variations
that can lead to negative zlib_mem being reported. The alloc() function
uses the requested size while the free() function uses the pool size. The
difference can happen when pools are shared with other pools of similar
size. The net effect is that zlib_mem can be reported negative with a
slowly decreasing count, and over the long term the limit will not be
enforced anymore.

The fix is simple : let's use the pool size in both cases, which is also
the exact value when it comes to memory usage.

This fix must be backported to 1.5.
src/compression.c