Expand description
Tensor memory pool for reducing allocation pressure in hot loops. Thread-local tensor buffer pool for reusing allocations.
In tight loops (e.g., 50-layer NN forward pass), the same tensor sizes are allocated and freed every iteration. This pool caches freed buffers and returns them on the next allocation of the same size, avoiding repeated malloc/free cycles.
§Determinism
Pool reuse does NOT affect computed values — only memory addresses change. The buffer contents are always overwritten before use. Snap hashes are computed from data, not addresses, so they remain identical.
§Usage
ⓘ
// Get a buffer (may be recycled or freshly allocated)
let mut buf = tensor_pool::acquire(1000);
// ... fill buf with data ...
// Buffer is returned to pool when dropped (via TensorPool::recycle)