let s = BitSet::new();
println!("Size of bitset: {} bytes", std::mem::size_of_val(&s));
The above code gives 32 bytes as the size of empty bitset. Why does an empty bitset need to be 32 bytes?
Also, with a bitset of larger capacity, I still get the size as 32 bits. Shouldn't a bitset of capacity 1024 be 1024/8 = 128 bytes ?
let s = BitSet::with_capacity(1024);
println!("Size of bitset: {} bytes", std::mem::size_of_val(&s));
The above code gives 32 bytes as the size of empty bitset. Why does an empty bitset need to be 32 bytes? Also, with a bitset of larger capacity, I still get the size as 32 bits. Shouldn't a bitset of capacity 1024 be 1024/8 = 128 bytes ?