Skip to main content

Module buffer_pool

Module buffer_pool 

Source
Expand description

A pool that recycles the prover’s large, short-lived working buffers.

BufferPool is the seam through which those allocations flow, recycling freed blocks instead of returning them to the global allocator. Buffers are handed out as PoolVec handles that borrow the pool for 'alloc and return their block to it on drop.

Every pooled block is allocated with a fixed BUFFER_ALIGN-byte alignment — wide enough for any element type the prover uses — and sized to a power-of-two number of bytes. Because the alignment is uniform, the free list keys purely on byte size: a block freed by one element type can back a PoolVec of any other type of the same size. Blocks are stored as owned Vec<AlignedChunk>, so the pool frees them through ordinary Vec machinery; a PoolVec borrows a block’s memory as a Vec<T> for its lifetime and hands it back on drop.

Structs§

BufferPool
A pool that hands out reusable buffers for prover working memory.
PoolVec
A Vec-like buffer borrowed from a BufferPool for 'alloc.