Skip to content

Commit 0c9e8d9

Browse files
committed
Merge branch 'main'
Signed-off-by: Jay Lee <[email protected]>
2 parents 3b21b21 + f260a80 commit 0c9e8d9

File tree

18 files changed

+337
-109
lines changed

18 files changed

+337
-109
lines changed

Diff for: .github/workflows/main.yml

+16-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: CI
22

33
on:
44
pull_request:
5-
branches:
5+
branches:
66
- 'master'
77
- 'main'
88
push:
@@ -16,11 +16,11 @@ jobs:
1616
strategy:
1717
matrix:
1818
include:
19-
- name: aarch64-unknown-linux-gnu
20-
target: aarch64-unknown-linux-gnu
19+
- name: x86_64-apple-darwin
20+
target: x86_64-apple-darwin
2121
nobgt: 0
2222
no_tests: 1
23-
tag: arm64
23+
tag: macos-13
2424
- name: x86_64-unknown-linux-gnu (nightly)
2525
target: x86_64-unknown-linux-gnu
2626
nobgt: 0
@@ -38,11 +38,17 @@ jobs:
3838
nobgt: 1
3939
no_tests: 1
4040
tag: ubuntu-latest
41-
- name: x86_64-apple-darwin (stable)
42-
target: x86_64-apple-darwin
41+
- name: aarch64-apple-darwin (stable)
42+
target: aarch64-apple-darwin
4343
nobgt: 0
4444
no_tests: 1
4545
tag: macos-latest
46+
- name: x86_64-unknown-linux-gnu (msrv)
47+
target: x86_64-unknown-linux-gnu
48+
nobgt: 0
49+
no_tests: 0
50+
rust: msrv
51+
tag: ubuntu-latest
4652
runs-on: ${{ matrix.tag }}
4753
env:
4854
TARGET: ${{ matrix.target }}
@@ -57,6 +63,9 @@ jobs:
5763
if [[ "${{ matrix.rust }}" == "nightly" ]]; then
5864
rustup default nightly
5965
fi
66+
if [[ "${{ matrix.rust }}" == "msrv" ]]; then
67+
rustup default `grep rust-version jemalloc-sys/Cargo.toml | cut -d '"' -f 2`
68+
fi
6069
rustup target add ${{ matrix.target }}
6170
if [[ "$TARGET" == "x86_64-unknown-linux-musl" ]]; then
6271
sudo apt install -y musl-tools
@@ -85,5 +94,5 @@ jobs:
8594
- run: cargo clippy -p jemallocator -- -D clippy::all
8695
- run: cargo clippy -p jemallocator-global -- -D clippy::all
8796
- run: cargo clippy -p jemalloc-ctl -- -D clippy::all
88-
- run: env RUSTDOCFLAGS="--cfg jemallocator_docs" cargo doc
97+
- run: env RUSTDOCFLAGS="--cfg jemallocator_docs" cargo doc --features stats,profiling,use_std
8998
- run: shellcheck ci/*.sh

Diff for: .gitmodules

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "jemalloc-sys/jemalloc"]
22
path = jemalloc-sys/jemalloc
3-
url = https://github.com/jemalloc/jemalloc
3+
url = https://github.com/tikv/jemalloc

Diff for: CHANGELOG.md

+17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# 0.6.0 - 2024-07-14
2+
3+
- Fix build on riscv64gc-unknown-linux-musl (#67) (#75)
4+
- Allow jemalloc-sys to be the default allocator on musl linux (#70)
5+
- Add Chimera Linux to gmake targets (#73)
6+
- Add profiling options to jemalloc-ctl (#74)
7+
- Fix jemalloc version not shown in API (#77)
8+
- Fix jemalloc stats is still enabled when stats feature is disabled (#82)
9+
- Fix duplicated symbol when build and link on aarch64-linux-android (#83)
10+
- Revise CI runner platform on macOS (#86)
11+
- Allow setting per-target env (#91)
12+
- Remove outdated clippy allows (#94)
13+
- Set MSRV to 1.71.0 (#95)
14+
15+
Note since 0.6.0, if you want to use jemalloc stats, you have to enable the
16+
feature explicitly.
17+
118
# 0.5.4 - 2023-07-22
219

320
- Add disable_initial_exec_tls feature for jemalloc-ctl (#59)

Diff for: jemalloc-ctl/Cargo.toml

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "jemalloc-ctl"
3-
version = "0.5.4"
3+
version = "0.6.0"
44
authors = [
55
"Steven Fackler <[email protected]>",
66
"Gonzalo Brito Gadeschi <[email protected]>",
@@ -26,17 +26,20 @@ is-it-maintained-open-issues = { repository = "tikv/jemallocator" }
2626
maintenance = { status = "actively-developed" }
2727

2828
[dependencies]
29-
jemalloc-sys = { path = "../jemalloc-sys", version = "0.5.0" }
29+
jemalloc-sys = { path = "../jemalloc-sys", version = "0.6.0" }
3030
libc = { version = "0.2", default-features = false }
3131
paste = "1"
3232

3333
[dev-dependencies]
34-
jemallocator = { path = "../jemallocator", version = "0.5.0" }
34+
jemallocator = { path = "../jemallocator", version = "0.6.0" }
3535

3636
[features]
3737
default = []
38+
stats = ["jemalloc-sys/stats"]
39+
profiling = ["jemalloc-sys/profiling"]
3840
use_std = [ "libc/use_std" ]
3941
disable_initial_exec_tls = ["jemalloc-sys/disable_initial_exec_tls"]
4042

4143
[package.metadata.docs.rs]
4244
rustdoc-args = [ "--cfg", "jemallocator_docs" ]
45+
features = ["stats", "profiling", "use_std"]

Diff for: jemalloc-ctl/src/error.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
//! Error type
2-
#![cfg_attr(
3-
feature = "cargo-clippy",
4-
allow(clippy::cast_sign_loss, clippy::cast_possible_wrap)
5-
)]
62
73
use crate::{fmt, num, result};
84
use libc::c_int;

Diff for: jemalloc-ctl/src/lib.rs

+59-52
Original file line numberDiff line numberDiff line change
@@ -13,62 +13,66 @@
1313
//! `$op::{read(), write(x), update(x)}` on the type calls `mallctl` with the
1414
//! string-based API. If the operation will be repeatedly performed, a MIB for
1515
//! the operation can be obtained using `$op.mib()`.
16-
//!
17-
//! # Examples
18-
//!
19-
//! Repeatedly printing allocation statistics:
20-
//!
21-
//! ```no_run
22-
//! use std::thread;
23-
//! use std::time::Duration;
24-
//! use jemalloc_ctl::{stats, epoch};
25-
//!
26-
//! #[global_allocator]
27-
//! static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
28-
//!
29-
//! fn main() {
30-
//! loop {
31-
//! // many statistics are cached and only updated when the epoch is advanced.
32-
//! epoch::advance().unwrap();
33-
//!
34-
//! let allocated = stats::allocated::read().unwrap();
35-
//! let resident = stats::resident::read().unwrap();
36-
//! println!("{} bytes allocated/{} bytes resident", allocated, resident);
37-
//! thread::sleep(Duration::from_secs(10));
38-
//! }
39-
//! }
40-
//! ```
41-
//!
42-
//! Doing the same with the MIB-based API:
43-
//!
44-
//! ```no_run
45-
//! use std::thread;
46-
//! use std::time::Duration;
47-
//! use jemalloc_ctl::{stats, epoch};
48-
//!
49-
//! #[global_allocator]
50-
//! static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
51-
//!
52-
//! fn main() {
53-
//! let e = epoch::mib().unwrap();
54-
//! let allocated = stats::allocated::mib().unwrap();
55-
//! let resident = stats::resident::mib().unwrap();
56-
//! loop {
57-
//! // many statistics are cached and only updated when the epoch is advanced.
58-
//! e.advance().unwrap();
59-
//!
60-
//! let allocated = allocated.read().unwrap();
61-
//! let resident = resident.read().unwrap();
62-
//! println!("{} bytes allocated/{} bytes resident", allocated, resident);
63-
//! thread::sleep(Duration::from_secs(10));
64-
//! }
65-
//! }
66-
//! ```
16+
#![cfg_attr(
17+
feature = "stats",
18+
doc = r##"
19+
20+
# Examples
21+
22+
Repeatedly printing allocation statistics:
23+
24+
```no_run
25+
use std::thread;
26+
use std::time::Duration;
27+
use jemalloc_ctl::{stats, epoch};
28+
29+
#[global_allocator]
30+
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
31+
32+
fn main() {
33+
loop {
34+
// many statistics are cached and only updated when the epoch is advanced.
35+
epoch::advance().unwrap();
36+
37+
let allocated = stats::allocated::read().unwrap();
38+
let resident = stats::resident::read().unwrap();
39+
println!("{} bytes allocated/{} bytes resident", allocated, resident);
40+
thread::sleep(Duration::from_secs(10));
41+
}
42+
}
43+
```
44+
45+
Doing the same with the MIB-based API:
46+
47+
```no_run
48+
use std::thread;
49+
use std::time::Duration;
50+
use jemalloc_ctl::{stats, epoch};
51+
52+
#[global_allocator]
53+
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
54+
55+
fn main() {
56+
let e = epoch::mib().unwrap();
57+
let allocated = stats::allocated::mib().unwrap();
58+
let resident = stats::resident::mib().unwrap();
59+
loop {
60+
// many statistics are cached and only updated when the epoch is advanced.
61+
e.advance().unwrap();
62+
63+
let allocated = allocated.read().unwrap();
64+
let resident = resident.read().unwrap();
65+
println!("{} bytes allocated/{} bytes resident", allocated, resident);
66+
thread::sleep(Duration::from_secs(10));
67+
}
68+
}
69+
```
70+
"##
71+
)]
6772
// TODO: rename the following lint on next minor bump
6873
#![allow(renamed_and_removed_lints)]
6974
#![deny(missing_docs, broken_intra_doc_links)]
7075
#![cfg_attr(not(feature = "use_std"), no_std)]
71-
#![cfg_attr(feature = "cargo-clippy", allow(clippy::module_name_repetitions))]
7276

7377
#[cfg(test)]
7478
#[global_allocator]
@@ -88,7 +92,10 @@ pub mod config;
8892
mod error;
8993
mod keys;
9094
pub mod opt;
95+
#[cfg(feature = "profiling")]
96+
pub mod profiling;
9197
pub mod raw;
98+
#[cfg(feature = "stats")]
9299
pub mod stats;
93100
#[cfg(feature = "use_std")]
94101
pub mod stats_print;

0 commit comments

Comments
 (0)