Module Device.Lru_allocator
LRU buffer reuse layer.
Wraps a raw allocator so that freed buffers are cached by (size, spec) and reused on subsequent allocations. Buffers marked Buffer_spec.t.nolru or carrying an Buffer_spec.t.external_ptr bypass the cache and are freed immediately. When a fresh allocation fails, the entire cache is flushed and the allocation is retried once.
val wrap : 'buf Allocator.t -> 'buf Allocator.twrap alloc is alloc augmented with LRU buffer reuse.