#bz2 #compressor #decompressor #target #compression #kb #esp32 #decompression #ram

no-std tinybz2

Minimal-memory bz2 compressor/decompressor for embedded targets

3 releases

0.1.2 Feb 4, 2026
0.1.1 Feb 4, 2026
0.1.0 Feb 4, 2026

#700 in Embedded development

MIT/Apache

88KB
1.5K SLoC

tinybz2 — Minimal-memory bz2 for embedded targets

A no_std, zero-dependency bz2 compressor and decompressor designed to run on ESP32 and other memory-constrained microcontrollers.

Design goals

  • ~110 KB peak RAM at block size 1 (100 KB blocks) for both compress and decompress — roughly 10× less than stock libbz2.
  • Zero heap allocation — all working memory is caller-provided via fixed-size workspace structs.
  • no_std + no alloc — suitable for bare-metal and RTOS targets.
  • Streaming API — process data in chunks without buffering the entire input.

Memory budget at block size 1 (100 000 bytes)

Component Bytes
Block buffer 100 000
BWT workspace 512
MTF table 256
Huffman tables 10 000
Bookkeeping 1 024
Total ~112 KB

No runtime deps

Features