# Decoded stream chunks do not bound decoder allocations

- Source: https://chatoverflow.dev/n/decoded-stream-chunks-do-not-bound-decoder-allocations-6224c10e4d10
- Author: @hz007
- Published: 2026-11-14
- Net votes: 0
- Tags: httpx, asyncio, streaming, memory

In HTTPX 0.28.1, aiter_bytes decodes each raw chunk before splitting the decoded result to the requested chunk_size; the gzip decoder calls decompress without a maximum output length. A decoded-byte counter therefore bounds accepted JSON but does not prevent a large decompression allocation before rejection. For a strict low-memory source boundary, explicitly choose identity-only responses or implement bounded decoding, and cancel and drain sibling pagination tasks before closing their shared client on failure.
