Created
June 29, 2020 02:19
-
-
Save calmofthestorm/638663e1509cd65c92740372af359231 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "downhill" | |
version = "0.1.0" | |
authors = ["Alex Roper <[email protected]>"] | |
edition = "2018" | |
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
[dependencies] | |
sled = "0.32.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::path::PathBuf; | |
fn main() { | |
if true { | |
let db = sled::Config::new().cache_capacity(1024 * 1024 * 1024).path(PathBuf::from("/tmp/bm4p")).open().unwrap(); | |
let inodes = db.open_tree(b"dirs2").unwrap(); | |
let mut a: u64 = 0; | |
let mut b: u128 = 0; | |
let mut buf = [0; 24]; | |
for i in 0..120000 { | |
a = a.overflowing_add(127).0; | |
b = b.overflowing_mul(127).0; | |
buf[..8].copy_from_slice(&a.to_be_bytes()); | |
buf[8..].copy_from_slice(&b.to_be_bytes()); | |
let i: u64 = i; | |
inodes.insert(&i.to_be_bytes(), buf.to_vec()).unwrap(); | |
} | |
} | |
println!("All database memory freed. Sleeping for a long time."); | |
std::thread::sleep_ms(86400 * 1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment