From: melancholictheory (@melancholictheory) <noreply+melancholictheory@github.com>
To: pgbackrest/pgbackrest <noreply+pgbackrest-pgbackrest@github.com>
Subject: [pgbackrest/pgbackrest] PR #2912: Fix excessive memory use by the memory context free list.
Date: Sat, 07 Nov 2026 14:29:24 +0000
Message-ID: <gh-pgbackrest-pgbackrest-2912@github.com> (raw)
## Summary
- Limit the memory context free list to allocations matching the configured I/O buffer size (buffer-size).
- Keep the eight-block and 64 MiB limits per process. Return blocks of other sizes to the allocator.
- Cover reuse, size mismatches, both limits, and memory-context cleanup in the unit tests.
Fixes #2911. This is the single-bucket variant discussed in the review.
## Testing
- Passed common/mem-context and all six storage unit-test modules with full coverage.
- Generated the HTML documentation with example execution disabled.
- Repeated the block-incremental differential backup workload from #2816 against local MinIO, using 10,000 small PostgreSQL 18 tables and six runs per build. Compared with the revert, median elapsed time fell from 3.22 s to 2.88 s on ARM64 and from 3.31 s to 2.95 s on x86-64. On the x86-64 host the single bucket was faster in all six rounds, with 33.4 MiB peak anonymous RSS versus 51.3 MiB for the original free list. [ARM64 results](https://github.com/pgbackrest/pgbackrest/pull/2912#issuecomment-6739740033) ยท [x86-64 results](https://github.com/pgbackrest/pgbackrest/pull/2912#issuecomment-6740094300)