ZLib is an abstraction of the DEFLATE compression algorithm. It can (losslessly) compress and decompress data. DEFLATE uses a combination of the LZ77 sliding window and Huffmann coding to achieve compression.
ZLib is a third party module, and as such, the finer details of the zlib implementation are sometimes not known. Thus, the documentation of the zlib module is at times sparse.
ZLib can compress data to and extract data from the zlib
format. This format is somewhat a
The API Documentation is generated by Doxygen.
Taken from zconf.h:
The memory requirements for deflate are (in bytes):
(1 << (windowBits+2)) + (1 << (memLevel+9))
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default
values) plus a few kilobytes for small objects.
Taken from zconf.h:
The memory requirements for inflate are (in bytes):
1 << windowBits
that is, 32K for windowBits=15 (default value) plus a few kilobytes
for small objects.
ZLib has a load of static const int data on the
stack. Most of it is static huffmann trees, lengths and distances.
ZLib has three OperaGlobals, m_static_l_desc,
m_static_d_desc and m_static_bl_desc. All
have the type static_tree_desc_s.
ZLib functions that may run out of memory will return
Z_MEM_ERROR if an allocation fails. (Notable exception is
updatewindow, that returns 1. However, ZLib functions
that call updatewindow will still return
Z_MEM_ERROR if this happens.) Handling OOM is left to
caller.