Skip to content

Commit

Permalink
Merge pull request #12 from oiwn/dev
Browse files Browse the repository at this point in the history
fix memory usage calculation
  • Loading branch information
oiwn authored Jan 6, 2025
2 parents 8660e77 + e5a6136 commit a2d8380
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ name = "bloom-server"
path = "src/bin/server.rs"
required-features = ["server", "redb"]

[package.metadata.docs.rs]
no-default-features = true
features = ["redb"]

[features]
default = ["redb", "server"]
redb = ["dep:redb"]
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,11 @@ Memory usage is calculated as:

```
total_bits = capacity * max_levels
memory_bytes = total_bits / 8
memory_bytes = total_bits * 8
```

Since i use `u8` to store `bool`.

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
Expand Down
2 changes: 1 addition & 1 deletion src/bin/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async fn main() {
// Calculate the memory usage estimation
let bits_per_level = filter_config.capacity;
let total_bits = bits_per_level * filter_config.max_levels;
let estimated_memory_kb = (total_bits as f64 / 8.0 / 1024.0).ceil();
let estimated_memory_kb = (total_bits as f64 * 8.0 / 1024.0).ceil();

info!(
r#"
Expand Down

0 comments on commit a2d8380

Please sign in to comment.