1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-08-01 13:37:48 +00:00

improve memory usage estimation

This commit is contained in:
Michael Debertol 2021-05-02 17:27:44 +02:00
parent 484558e37d
commit dc5bd9f0be

View file

@ -281,7 +281,9 @@ pub struct Line {
impl Line { impl Line {
pub fn estimate_size(&self) -> usize { pub fn estimate_size(&self) -> usize {
self.line.capacity() + self.selections.capacity() * std::mem::size_of::<Selection>() self.line.capacity()
+ self.selections.capacity() * std::mem::size_of::<Selection>()
+ std::mem::size_of::<Self>()
} }
pub fn new(line: String, settings: &GlobalSettings) -> Self { pub fn new(line: String, settings: &GlobalSettings) -> Self {