http_proto icon indicating copy to clipboard operation
http_proto copied to clipboard

parser_service and serializer_service should probe zlib's memory footprint

Open ashtum opened this issue 5 months ago • 1 comments

Currently we are using the suggested formula from zlib's documentation: https://github.com/cppalliance/http_proto/blob/cf22661f3e2811a328aec5e8574fe637017ac007/src/parser.cpp#L472-L480

However, it has the same issue mentioned in the documentation:

zlib's memory footprint can also be specified fairly precisely. It is larger for compression than for decompression, and the exact requirements depend on how the library was compiled.

The probe operation should be performed once during parser_service and serializer_service installation and should take into account all configuration parameters used for deflate and inflate.

ashtum avatar Aug 23 '25 17:08 ashtum

You can just go back in the commit and get the probe code, it replaces the allocation functions in the z_stream with an implementation that performs measurements.

vinniefalco avatar Aug 23 '25 18:08 vinniefalco