CreateCompressor()
and CreateDecompressor()
functions normally allocate some memory to hold the state of the engines. The compression engine needs around 50 KB of storage, while the decompressor needs around 5 KB.
If your title has sophisticated memory management needs, you can supply a memory buffer yourself to avoid having the folio allocate any memory. To do this, call the GetCompressorWorkBufferSize()
routine to obtain the size of the buffer needed for the compression engine, or you can call GetDecompressorWorkBufferSize()
to get the size of the buffer needed for the decompression engine. Once you have determined the size, then you can allocate a memory buffer, and pass a pointer to the buffer using the COMP_TAG_WORKBUFFER
tag when you create the compressor or decompressor.
When you supply the work buffer, the Compression folio allocates no, or almost no, resources when a compression or decompression engine is created. This allows your title to control where memory resources come from.