diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6af8dc363..1fa9c2746 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -106,26 +106,6 @@ jobs: command: test args: -p uint --target=mips64-unknown-linux-gnuabi64 - - name: Test parity-util-mem on Android - if: runner.os == 'Linux' - uses: actions-rs/cargo@v1 - with: - use-cross: true - command: test - args: -p parity-util-mem --target=aarch64-linux-android - - - name: Test parity-util-mem estimate-heapsize - run: cargo test -p parity-util-mem --features='estimate-heapsize' - - - name: Test parity-util-mem jemalloc-global - run: cargo test -p parity-util-mem --features='jemalloc-global' - - - name: Test parity-util-mem mimalloc-global - run: cargo test -p parity-util-mem --features='mimalloc-global' - - - name: Test parity-util-mem dlmalloc-global - run: cargo test -p parity-util-mem --no-default-features --features='dlmalloc-global' - test_windows: name: Test Windows runs-on: windows-latest diff --git a/kvdb-memorydb/Cargo.toml b/kvdb-memorydb/Cargo.toml index 78ac0038c..ca52d8a1b 100644 --- a/kvdb-memorydb/Cargo.toml +++ b/kvdb-memorydb/Cargo.toml @@ -9,7 +9,6 @@ edition = "2021" rust-version = "1.56.1" [dependencies] -parity-util-mem = { path = "../parity-util-mem", version = "0.12", default-features = false, features = ["std"] } parking_lot = "0.12.0" kvdb = { version = "0.12", path = "../kvdb" } diff --git a/kvdb-memorydb/src/lib.rs b/kvdb-memorydb/src/lib.rs index a6de728e2..67773b1ac 100644 --- a/kvdb-memorydb/src/lib.rs +++ b/kvdb-memorydb/src/lib.rs @@ -7,7 +7,6 @@ // except according to those terms. use kvdb::{DBKeyValue, DBOp, DBTransaction, DBValue, KeyValueDB}; -use parity_util_mem::MallocSizeOf; use parking_lot::RwLock; use std::{ collections::{BTreeMap, HashMap}, @@ -16,7 +15,7 @@ use std::{ /// A key-value database fulfilling the `KeyValueDB` trait, living in memory. /// This is generally intended for tests and is not particularly optimized. -#[derive(Default, MallocSizeOf)] +#[derive(Default)] pub struct InMemory { columns: RwLock, DBValue>>>, } diff --git a/kvdb-rocksdb/Cargo.toml b/kvdb-rocksdb/Cargo.toml index 3337fdfa8..a932b34ad 100644 --- a/kvdb-rocksdb/Cargo.toml +++ b/kvdb-rocksdb/Cargo.toml @@ -19,7 +19,6 @@ log = "0.4.8" num_cpus = "1.10.1" parking_lot = "0.12.0" regex = "1.3.1" -parity-util-mem = { path = "../parity-util-mem", version = "0.12", default-features = false, features = ["std", "smallvec"] } # OpenBSD and MSVC are unteested and shouldn't enable jemalloc: # https://github.com/tikv/jemallocator/blob/52de4257fab3e770f73d5174c12a095b49572fba/jemalloc-sys/build.rs#L26-L27 diff --git a/kvdb-rocksdb/examples/memtest.rs b/kvdb-rocksdb/examples/memtest.rs index 30923fb40..e41521bd5 100644 --- a/kvdb-rocksdb/examples/memtest.rs +++ b/kvdb-rocksdb/examples/memtest.rs @@ -145,7 +145,6 @@ fn main() { println!("{}", timestamp); println!("\tData written: {} keys - {} Mb", step + 1, ((step + 1) * 64 * 128) / 1024 / 1024); println!("\tProcess memory used as seen by the OS: {} Mb", proc_memory_usage() / 1024); - println!("\tMemory used as reported by rocksdb: {} Mb\n", parity_util_mem::malloc_size(&db) / 1024 / 1024); } step += 1; diff --git a/kvdb-rocksdb/src/lib.rs b/kvdb-rocksdb/src/lib.rs index beb137f56..487cd578b 100644 --- a/kvdb-rocksdb/src/lib.rs +++ b/kvdb-rocksdb/src/lib.rs @@ -16,7 +16,6 @@ use std::{ path::{Path, PathBuf}, }; -use parity_util_mem::MallocSizeOf; use rocksdb::{ BlockBasedOptions, ColumnFamily, ColumnFamilyDescriptor, Options, ReadOptions, WriteBatch, WriteOptions, DB, }; @@ -252,26 +251,6 @@ struct DBAndColumns { column_names: Vec, } -impl MallocSizeOf for DBAndColumns { - fn size_of(&self, ops: &mut parity_util_mem::MallocSizeOfOps) -> usize { - let mut total = self.column_names.size_of(ops) - // we have at least one column always, so we can call property on it - + self.cf(0).map(|cf| self.db - .property_int_value_cf(cf, "rocksdb.block-cache-usage") - .unwrap_or(Some(0)) - .map(|x| x as usize) - .unwrap_or(0) - ).unwrap_or(0); - - for v in 0..self.column_names.len() { - total += self.static_property_or_warn(v, "rocksdb.estimate-table-readers-mem"); - total += self.static_property_or_warn(v, "rocksdb.cur-size-all-mem-tables"); - } - - total - } -} - impl DBAndColumns { fn cf(&self, i: usize) -> io::Result<&ColumnFamily> { let name = self.column_names.get(i).ok_or_else(|| invalid_column(i as u32))?; @@ -299,22 +278,14 @@ impl DBAndColumns { } /// Key-Value database. -#[derive(MallocSizeOf)] pub struct Database { inner: DBAndColumns, - #[ignore_malloc_size_of = "insignificant"] config: DatabaseConfig, - #[ignore_malloc_size_of = "insignificant"] path: PathBuf, - #[ignore_malloc_size_of = "insignificant"] opts: Options, - #[ignore_malloc_size_of = "insignificant"] write_opts: WriteOptions, - #[ignore_malloc_size_of = "insignificant"] read_opts: ReadOptions, - #[ignore_malloc_size_of = "insignificant"] block_opts: BlockBasedOptions, - #[ignore_malloc_size_of = "insignificant"] stats: stats::RunningDbStats, } diff --git a/kvdb/Cargo.toml b/kvdb/Cargo.toml index 552d0149e..a926dffcb 100644 --- a/kvdb/Cargo.toml +++ b/kvdb/Cargo.toml @@ -10,4 +10,3 @@ rust-version = "1.56.1" [dependencies] smallvec = "1.0.0" -parity-util-mem = { path = "../parity-util-mem", version = "0.12", default-features = false } diff --git a/kvdb/src/lib.rs b/kvdb/src/lib.rs index 155a9ef73..f44461cf0 100644 --- a/kvdb/src/lib.rs +++ b/kvdb/src/lib.rs @@ -104,7 +104,7 @@ impl DBTransaction { /// /// The API laid out here, along with the `Sync` bound implies interior synchronization for /// implementation. -pub trait KeyValueDB: Sync + Send + parity_util_mem::MallocSizeOf { +pub trait KeyValueDB: Sync + Send { /// Helper to create a new transaction. fn transaction(&self) -> DBTransaction { DBTransaction::new()