Expand description
Circular (ring) buffer implementation with secure memory management
§Memory Safety
The circular buffer uses lazy allocation and secure memory clearing:
- Memory is only allocated when first written to
- All data is securely zeroed on drop using compiler-resistant clearing
- The
free()andburn_free()methods provide explicit cleanup for connection/session termination patterns
§Performance
- Power-of-2 sizes use fast bitwise modulo (recommended)
- Non-power-of-2 sizes use standard modulo (slightly slower)
- Lazy allocation reduces memory footprint for unused buffers
BUGFIX: Previous implementation had incorrect memory clearing in drop/free/burn_free. It was creating a Vec copy of the Box<u8>, zeroing the copy, then dropping the original unzeroed data. This has been fixed to properly convert and zero the original.
Structs§
- Circular
Buffer - A circular (ring) buffer for efficient streaming data.