From 0fb02049ac4119f2c2d1c535189f218c2810ab10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E6=AD=A3=E8=B6=85?= Date: Wed, 3 Jun 2026 23:40:29 +0800 Subject: [PATCH] fix(ecstore): remove dead _buf field from Erasure struct (#3196) * fix(ecstore): remove dead _buf field from Erasure struct _buf was allocated in new(), clone(), and Default but never read or written. Each clone() was allocating block_size bytes (typically 10MB) for nothing. - Remove _buf from struct, Default, Clone, new_with_options - 51 erasure tests pass * fix: remove empty line after doc comment --------- Co-authored-by: houseme --- crates/ecstore/src/erasure_coding/erasure.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/crates/ecstore/src/erasure_coding/erasure.rs b/crates/ecstore/src/erasure_coding/erasure.rs index 6d2dd962d..bcee61785 100644 --- a/crates/ecstore/src/erasure_coding/erasure.rs +++ b/crates/ecstore/src/erasure_coding/erasure.rs @@ -308,7 +308,6 @@ where /// - `encoder`: Optional ReedSolomon encoder instance. /// - `block_size`: Block size for each shard. /// - `_id`: Unique identifier for the erasure instance. -/// - `_buf`: Internal buffer for block operations. /// /// # Example /// ```ignore @@ -326,7 +325,6 @@ pub struct Erasure { pub block_size: usize, uses_legacy: bool, _id: Uuid, - _buf: Vec, } impl Default for Erasure { @@ -339,7 +337,6 @@ impl Default for Erasure { block_size: 0, uses_legacy: false, _id: Uuid::nil(), - _buf: vec![], } } } @@ -354,7 +351,6 @@ impl Clone for Erasure { block_size: self.block_size, uses_legacy: self.uses_legacy, _id: Uuid::new_v4(), // Generate new ID for clone - _buf: vec![0u8; self.block_size], } } } @@ -399,7 +395,6 @@ impl Erasure { legacy_encoder, uses_legacy, _id: Uuid::new_v4(), - _buf: vec![0u8; block_size], } }