From f260a80f21b7f9eb1212809720d9a5f7f0cf0e8b Mon Sep 17 00:00:00 2001 From: Jay Date: Sun, 14 Jul 2024 23:34:47 +0800 Subject: [PATCH] *: bump 0.6.0 (#95) Signed-off-by: Jay Lee --- .github/workflows/main.yml | 16 +++-- CHANGELOG.md | 17 ++++++ jemalloc-ctl/Cargo.toml | 8 ++- jemalloc-ctl/src/lib.rs | 108 +++++++++++++++++---------------- jemalloc-sys/Cargo.toml | 5 +- jemallocator-global/Cargo.toml | 6 +- jemallocator-global/README.md | 2 +- jemallocator-global/src/lib.rs | 2 +- jemallocator/Cargo.toml | 12 ++-- jemallocator/README.md | 2 +- 10 files changed, 106 insertions(+), 72 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 659aec53f..721e5d089 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,11 +16,6 @@ jobs: strategy: matrix: include: - - name: aarch64-unknown-linux-gnu - target: aarch64-unknown-linux-gnu - nobgt: 0 - no_tests: 1 - tag: arm64 - name: x86_64-apple-darwin target: x86_64-apple-darwin nobgt: 0 @@ -48,6 +43,12 @@ jobs: nobgt: 0 no_tests: 1 tag: macos-latest + - name: x86_64-unknown-linux-gnu (msrv) + target: x86_64-unknown-linux-gnu + nobgt: 0 + no_tests: 0 + rust: msrv + tag: ubuntu-latest runs-on: ${{ matrix.tag }} env: TARGET: ${{ matrix.target }} @@ -62,6 +63,9 @@ jobs: if [[ "${{ matrix.rust }}" == "nightly" ]]; then rustup default nightly fi + if [[ "${{ matrix.rust }}" == "msrv" ]]; then + rustup default `grep rust-version jemalloc-sys/Cargo.toml | cut -d '"' -f 2` + fi rustup target add ${{ matrix.target }} if [[ "$TARGET" == "x86_64-unknown-linux-musl" ]]; then sudo apt install -y musl-tools @@ -90,5 +94,5 @@ jobs: - run: cargo clippy -p tikv-jemallocator -- -D clippy::all - run: cargo clippy -p tikv-jemallocator-global -- -D clippy::all - run: cargo clippy -p tikv-jemalloc-ctl -- -D clippy::all - - run: env RUSTDOCFLAGS="--cfg jemallocator_docs" cargo doc + - run: env RUSTDOCFLAGS="--cfg jemallocator_docs" cargo doc --features stats,profiling,use_std - run: shellcheck ci/*.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index bcd561ba1..e160b5d17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ +# 0.6.0 - 2024-07-14 + +- Fix build on riscv64gc-unknown-linux-musl (#67) (#75) +- Allow jemalloc-sys to be the default allocator on musl linux (#70) +- Add Chimera Linux to gmake targets (#73) +- Add profiling options to jemalloc-ctl (#74) +- Fix jemalloc version not shown in API (#77) +- Fix jemalloc stats is still enabled when stats feature is disabled (#82) +- Fix duplicated symbol when build and link on aarch64-linux-android (#83) +- Revise CI runner platform on macOS (#86) +- Allow setting per-target env (#91) +- Remove outdated clippy allows (#94) +- Set MSRV to 1.71.0 (#95) + +Note since 0.6.0, if you want to use jemalloc stats, you have to enable the +feature explicitly. + # 0.5.4 - 2023-07-22 - Add disable_initial_exec_tls feature for jemalloc-ctl (#59) diff --git a/jemalloc-ctl/Cargo.toml b/jemalloc-ctl/Cargo.toml index f477ce754..a1e450c58 100644 --- a/jemalloc-ctl/Cargo.toml +++ b/jemalloc-ctl/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tikv-jemalloc-ctl" -version = "0.5.4" +version = "0.6.0" authors = [ "Steven Fackler ", "Gonzalo Brito Gadeschi ", @@ -26,18 +26,20 @@ is-it-maintained-open-issues = { repository = "tikv/jemallocator" } maintenance = { status = "actively-developed" } [dependencies] -tikv-jemalloc-sys = { path = "../jemalloc-sys", version = "0.5.0" } +tikv-jemalloc-sys = { path = "../jemalloc-sys", version = "0.6.0" } libc = { version = "0.2", default-features = false } paste = "1" [dev-dependencies] -tikv-jemallocator = { path = "../jemallocator", version = "0.5.0" } +tikv-jemallocator = { path = "../jemallocator", version = "0.6.0" } [features] default = [] +stats = ["tikv-jemalloc-sys/stats"] profiling = ["tikv-jemalloc-sys/profiling"] use_std = [ "libc/use_std" ] disable_initial_exec_tls = ["tikv-jemalloc-sys/disable_initial_exec_tls"] [package.metadata.docs.rs] rustdoc-args = [ "--cfg", "jemallocator_docs" ] +features = ["stats", "profiling", "use_std"] diff --git a/jemalloc-ctl/src/lib.rs b/jemalloc-ctl/src/lib.rs index e0abb991b..487f719fe 100644 --- a/jemalloc-ctl/src/lib.rs +++ b/jemalloc-ctl/src/lib.rs @@ -13,57 +13,62 @@ //! `$op::{read(), write(x), update(x)}` on the type calls `mallctl` with the //! string-based API. If the operation will be repeatedly performed, a MIB for //! the operation can be obtained using `$op.mib()`. -//! -//! # Examples -//! -//! Repeatedly printing allocation statistics: -//! -//! ```no_run -//! use std::thread; -//! use std::time::Duration; -//! use tikv_jemalloc_ctl::{stats, epoch}; -//! -//! #[global_allocator] -//! static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; -//! -//! fn main() { -//! loop { -//! // many statistics are cached and only updated when the epoch is advanced. -//! epoch::advance().unwrap(); -//! -//! let allocated = stats::allocated::read().unwrap(); -//! let resident = stats::resident::read().unwrap(); -//! println!("{} bytes allocated/{} bytes resident", allocated, resident); -//! thread::sleep(Duration::from_secs(10)); -//! } -//! } -//! ``` -//! -//! Doing the same with the MIB-based API: -//! -//! ```no_run -//! use std::thread; -//! use std::time::Duration; -//! use tikv_jemalloc_ctl::{stats, epoch}; -//! -//! #[global_allocator] -//! static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; -//! -//! fn main() { -//! let e = epoch::mib().unwrap(); -//! let allocated = stats::allocated::mib().unwrap(); -//! let resident = stats::resident::mib().unwrap(); -//! loop { -//! // many statistics are cached and only updated when the epoch is advanced. -//! e.advance().unwrap(); -//! -//! let allocated = allocated.read().unwrap(); -//! let resident = resident.read().unwrap(); -//! println!("{} bytes allocated/{} bytes resident", allocated, resident); -//! thread::sleep(Duration::from_secs(10)); -//! } -//! } -//! ``` +#![cfg_attr( + feature = "stats", + doc = r##" + +# Examples + +Repeatedly printing allocation statistics: + +```no_run +use std::thread; +use std::time::Duration; +use tikv_jemalloc_ctl::{stats, epoch}; + +#[global_allocator] +static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; + +fn main() { + loop { + // many statistics are cached and only updated when the epoch is advanced. + epoch::advance().unwrap(); + + let allocated = stats::allocated::read().unwrap(); + let resident = stats::resident::read().unwrap(); + println!("{} bytes allocated/{} bytes resident", allocated, resident); + thread::sleep(Duration::from_secs(10)); + } +} +``` + +Doing the same with the MIB-based API: + +```no_run +use std::thread; +use std::time::Duration; +use tikv_jemalloc_ctl::{stats, epoch}; + +#[global_allocator] +static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; + +fn main() { + let e = epoch::mib().unwrap(); + let allocated = stats::allocated::mib().unwrap(); + let resident = stats::resident::mib().unwrap(); + loop { + // many statistics are cached and only updated when the epoch is advanced. + e.advance().unwrap(); + + let allocated = allocated.read().unwrap(); + let resident = resident.read().unwrap(); + println!("{} bytes allocated/{} bytes resident", allocated, resident); + thread::sleep(Duration::from_secs(10)); + } +} +``` +"## +)] // TODO: rename the following lint on next minor bump #![allow(renamed_and_removed_lints)] #![deny(missing_docs, broken_intra_doc_links)] @@ -90,6 +95,7 @@ pub mod opt; #[cfg(feature = "profiling")] pub mod profiling; pub mod raw; +#[cfg(feature = "stats")] pub mod stats; #[cfg(feature = "use_std")] pub mod stats_print; diff --git a/jemalloc-sys/Cargo.toml b/jemalloc-sys/Cargo.toml index 7f716427a..220a6b8d0 100644 --- a/jemalloc-sys/Cargo.toml +++ b/jemalloc-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tikv-jemalloc-sys" -version = "0.5.4+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7" +version = "0.6.0+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7" authors = [ "Alex Crichton ", "Gonzalo Brito Gadeschi ", @@ -18,6 +18,7 @@ description = """ Rust FFI bindings to jemalloc """ edition = "2018" +rust-version = "1.71.0" [badges] codecov = { repository = "tikv/jemallocator" } @@ -32,7 +33,7 @@ libc = { version = "^0.2.8", default-features = false } cc = "^1.0.13" [features] -default = ["stats", "background_threads_runtime_support"] +default = ["background_threads_runtime_support"] profiling = [] debug = [] background_threads_runtime_support = [] diff --git a/jemallocator-global/Cargo.toml b/jemallocator-global/Cargo.toml index 31cfc9519..492f1f8fc 100644 --- a/jemallocator-global/Cargo.toml +++ b/jemallocator-global/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tikv-jemallocator-global" # Make sure to update the version in the readme as well: -version = "0.5.0" +version = "0.6.0" authors = [ "Gonzalo Brito Gadeschi ", "The TiKV Project Developers", @@ -26,7 +26,7 @@ is-it-maintained-open-issues = { repository = "tikv/jemallocator" } maintenance = { status = "actively-developed" } [dependencies] -tikv-jemallocator = { version = "0.5.0", path = "../jemallocator", optional = true } +tikv-jemallocator = { version = "0.6.0", path = "../jemallocator", optional = true } cfg-if = "0.1" [features] @@ -38,7 +38,7 @@ force_global_jemalloc = [ "tikv-jemallocator" ] # for a particular target, white-list the target explicitly here: [target.'cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))'.dependencies] -tikv-jemallocator = { version = "0.5.0", path = "../jemallocator", optional = false } +tikv-jemallocator = { version = "0.6.0", path = "../jemallocator", optional = false } # FIXME: https://github.com/gnzlbg/jemallocator/issues/91 # [target.'cfg(target_os = "windows")'.dependencies] diff --git a/jemallocator-global/README.md b/jemallocator-global/README.md index 51f7d06af..dbf26c6c5 100644 --- a/jemallocator-global/README.md +++ b/jemallocator-global/README.md @@ -11,7 +11,7 @@ Add it as a dependency: ```toml # Cargo.toml [dependencies] -tikv-jemallocator-global = "0.5.0" +tikv-jemallocator-global = "0.6.0" ``` and `jemalloc` will be used as the `#[global_allocator]` on targets that support diff --git a/jemallocator-global/src/lib.rs b/jemallocator-global/src/lib.rs index 424404463..e6f77678b 100644 --- a/jemallocator-global/src/lib.rs +++ b/jemallocator-global/src/lib.rs @@ -5,7 +5,7 @@ //! ```toml //! # Cargo.toml //! [dependencies] -//! jemallocator-global = "0.5.0" +//! jemallocator-global = "0.6.0" //! ``` //! //! and `jemalloc` will be used as the `#[global_allocator]` on targets that diff --git a/jemallocator/Cargo.toml b/jemallocator/Cargo.toml index 58954543f..a8a46b13c 100644 --- a/jemallocator/Cargo.toml +++ b/jemallocator/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tikv-jemallocator" # Make sure to update the version in the README as well: -version = "0.5.4" +version = "0.6.0" authors = [ "Alex Crichton ", "Gonzalo Brito Gadeschi ", @@ -32,16 +32,20 @@ maintenance = { status = "actively-developed" } test = false bench = false +[[test]] +name = "ffi" +required-features = ["stats"] + [dependencies] -tikv-jemalloc-sys = { path = "../jemalloc-sys", version = "0.5.0", default-features = false } +tikv-jemalloc-sys = { path = "../jemalloc-sys", version = "0.6.0", default-features = false } libc = { version = "^0.2.8", default-features = false } [dev-dependencies] paste = "1" -tikv-jemalloc-ctl = { path = "../jemalloc-ctl", version = "0.5.0" } +tikv-jemalloc-ctl = { path = "../jemalloc-ctl", version = "0.6.0" } [features] -default = ["stats", "background_threads_runtime_support"] +default = ["background_threads_runtime_support"] alloc_trait = [] profiling = ["tikv-jemalloc-sys/profiling"] debug = ["tikv-jemalloc-sys/debug"] diff --git a/jemallocator/README.md b/jemallocator/README.md index 7315a14c2..43e00d106 100644 --- a/jemallocator/README.md +++ b/jemallocator/README.md @@ -30,7 +30,7 @@ To use `tikv-jemallocator` add it as a dependency: [dependencies] [target.'cfg(not(target_env = "msvc"))'.dependencies] -tikv-jemallocator = "0.5" +tikv-jemallocator = "0.6" ``` To set `tikv_jemallocator::Jemalloc` as the global allocator add this to your project: