Skip to content

Commit

Permalink
*: revert name (#25)
Browse files Browse the repository at this point in the history
I will also publish this crate in the name of jemallocator. Because tikv-jemallocator is already used by several projects, to make less disturbing to dependents, two crates will be published at the same time with only name differences.

The tikv-xxx versions are maintained in the branch tikv-main.

Signed-off-by: Jay Lee <BusyJayLee@gmail.com>
  • Loading branch information
BusyJay committed Apr 29, 2022
1 parent 2706fb3 commit 161451b
Show file tree
Hide file tree
Showing 38 changed files with 167 additions and 160 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
name: CI

on: [pull_request]
on:
pull_request:
branches:
- 'master'
- 'tikv-main'
push:
branches:
- 'master'
- 'tikv-main'

jobs:
test:
Expand Down Expand Up @@ -73,9 +81,9 @@ jobs:
submodules: true
- run: rustup component add rustfmt clippy
- run: cargo fmt --all -- --check
- run: cargo clippy -p tikv-jemalloc-sys -- -D clippy::all
- 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: cargo clippy -p jemalloc-sys -- -D clippy::all
- run: cargo clippy -p jemallocator -- -D clippy::all
- run: cargo clippy -p jemallocator-global -- -D clippy::all
- run: cargo clippy -p jemalloc-ctl -- -D clippy::all
- run: env RUSTDOCFLAGS="--cfg jemallocator_docs" cargo doc
- run: shellcheck ci/*.sh
22 changes: 11 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "tikv-jemallocator"
name = "jemallocator"
# Make sure to update the version in the README as well:
version = "0.4.3"
authors = [
Expand All @@ -15,7 +15,7 @@ keywords = ["allocator", "jemalloc"]
categories = ["memory-management", "api-bindings"]
repository = "https://github.com/tikv/jemallocator"
homepage = "https://github.com/tikv/jemallocator"
documentation = "https://docs.rs/tikv-jemallocator"
documentation = "https://docs.rs/jemallocator"
description = """
A Rust allocator backed by jemalloc
"""
Expand All @@ -36,23 +36,23 @@ bench = false
members = ["systest", "jemallocator-global", "jemalloc-ctl", "jemalloc-sys" ]

[dependencies]
tikv-jemalloc-sys = { path = "jemalloc-sys", version = "0.4.0", default-features = false }
jemalloc-sys = { path = "jemalloc-sys", version = "0.4.0", default-features = false }
libc = { version = "^0.2.8", default-features = false }

[dev-dependencies]
paste = "1"
tikv-jemalloc-ctl = { path = "jemalloc-ctl", version = "0.4" }
jemalloc-ctl = { path = "jemalloc-ctl", version = "0.4" }

[features]
default = ["background_threads_runtime_support"]
alloc_trait = []
profiling = ["tikv-jemalloc-sys/profiling"]
debug = ["tikv-jemalloc-sys/debug"]
stats = ["tikv-jemalloc-sys/stats"]
background_threads_runtime_support = ["tikv-jemalloc-sys/background_threads_runtime_support"]
background_threads = ["tikv-jemalloc-sys/background_threads"]
unprefixed_malloc_on_supported_platforms = ["tikv-jemalloc-sys/unprefixed_malloc_on_supported_platforms"]
disable_initial_exec_tls = ["tikv-jemalloc-sys/disable_initial_exec_tls"]
profiling = ["jemalloc-sys/profiling"]
debug = ["jemalloc-sys/debug"]
stats = ["jemalloc-sys/stats"]
background_threads_runtime_support = ["jemalloc-sys/background_threads_runtime_support"]
background_threads = ["jemalloc-sys/background_threads"]
unprefixed_malloc_on_supported_platforms = ["jemalloc-sys/unprefixed_malloc_on_supported_platforms"]
disable_initial_exec_tls = ["jemalloc-sys/disable_initial_exec_tls"]

[package.metadata.docs.rs]
features = []
Expand Down
36 changes: 19 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# tikv-jemallocator
# jemallocator

[![ci]][github actions] [![Latest Version]][crates.io] [![docs]][docs.rs]

This project is a simplified fork of [jemallocator](https://github.com/gnzlbg/jemallocator) focus on server.
This project is the successor of [jemallocator](https://github.com/gnzlbg/jemallocator).

The project is published as `tikv-jemallocator` and `jemallocator` for historical reasons. The two crates are the same except names. It's OK to use either crate. For new projects, `jemallocator` should be used.

> Links against `jemalloc` and provides a `Jemalloc` unit type that implements
> the allocator APIs and can be set as the `#[global_allocator]`
Expand All @@ -11,32 +13,32 @@ This project is a simplified fork of [jemallocator](https://github.com/gnzlbg/je

The `jemalloc` support ecosystem consists of the following crates:

* `tikv-jemalloc-sys`: builds and links against `jemalloc` exposing raw C bindings to it.
* `tikv-jemallocator`: provides the `Jemalloc` type which implements the
* `jemalloc-sys`: builds and links against `jemalloc` exposing raw C bindings to it.
* `jemallocator`: provides the `Jemalloc` type which implements the
`GlobalAlloc` and `Alloc` traits.
* `tikv-jemalloc-ctl`: high-level wrapper over `jemalloc`'s control and introspection
* `jemalloc-ctl`: high-level wrapper over `jemalloc`'s control and introspection
APIs (the `mallctl*()` family of functions and the _MALLCTL NAMESPACE_)'

## Documentation

* [Latest release (docs.rs)][docs.rs]

To use `tikv-jemallocator` add it as a dependency:
To use `jemallocator` add it as a dependency:

```toml
# Cargo.toml
[dependencies]

[target.'cfg(not(target_env = "msvc"))'.dependencies]
tikv-jemallocator = "0.4.0"
jemallocator = "0.4.0"
```

To set `tikv_jemallocator::Jemalloc` as the global allocator add this to your project:
To set `jemallocator::Jemalloc` as the global allocator add this to your project:

```rust
# main.rs
#[cfg(not(target_env = "msvc"))]
use tikv_jemallocator::Jemalloc;
use jemallocator::Jemalloc;

#[cfg(not(target_env = "msvc"))]
#[global_allocator]
Expand All @@ -51,8 +53,8 @@ all allocations requested by Rust code in the same program.
The following table describes the supported platforms:

* `build`: does the library compile for the target?
* `run`: do `tikv-jemallocator` and `tikv-jemalloc-sys` tests pass on the target?
* `jemalloc`: do `tikv-jemalloc`'s tests pass on the target?
* `run`: do `jemallocator` and `jemalloc-sys` tests pass on the target?
* `jemalloc`: do `jemalloc`'s tests pass on the target?

Tier 1 targets are tested on all Rust channels (stable, beta, and nightly). All
other targets are only tested on Rust nightly.
Expand All @@ -67,7 +69,7 @@ other targets are only tested on Rust nightly.

## Features

The `tikv-jemallocator` crate re-exports the [features of the `tikv-jemalloc-sys`
The `jemallocator` crate re-exports the [features of the `jemalloc-sys`
dependency](https://github.com/tikv/jemallocator/blob/master/jemalloc-sys/README.md).

## License
Expand All @@ -84,12 +86,12 @@ at your option.
## Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in `tikv-jemallocator` by you, as defined in the Apache-2.0 license,
for inclusion in `jemallocator` by you, as defined in the Apache-2.0 license,
shall be dual licensed as above, without any additional terms or conditions.

[Latest Version]: https://img.shields.io/crates/v/tikv-jemallocator.svg
[crates.io]: https://crates.io/crates/tikv-jemallocator
[docs]: https://docs.rs/tikv-jemallocator/badge.svg
[docs.rs]: https://docs.rs/tikv-jemallocator/
[Latest Version]: https://img.shields.io/crates/v/jemallocator.svg
[crates.io]: https://crates.io/crates/jemallocator
[docs]: https://docs.rs/jemallocator/badge.svg
[docs.rs]: https://docs.rs/jemallocator/
[ci]: https://github.com/tikv/jemallocator/actions/workflows/main.yml/badge.svg
[github actions]: https://github.com/tikv/jemallocator/actions
2 changes: 1 addition & 1 deletion benches/roundtrip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

extern crate test;

use jemalloc_sys::MALLOCX_ALIGN;
use jemallocator::Jemalloc;
use libc::c_int;
use std::{
alloc::{Alloc, Excess, Layout},
ptr,
};
use test::Bencher;
use tikv_jemalloc_sys::MALLOCX_ALIGN;

#[global_allocator]
static A: Jemalloc = Jemalloc;
Expand Down
4 changes: 2 additions & 2 deletions ci/dox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ set -ex

export RUSTDOCFLAGS="--cfg jemallocator_docs"
cargo doc --features alloc_trait
cargo doc -p tikv-jemalloc-sys
cargo doc -p tikv-jemalloc-ctl
cargo doc -p jemalloc-sys
cargo doc -p jemalloc-ctl
8 changes: 4 additions & 4 deletions jemalloc-ctl/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "tikv-jemalloc-ctl"
name = "jemalloc-ctl"
version = "0.4.2"
authors = [
"Steven Fackler <sfackler@gmail.com>",
Expand All @@ -12,7 +12,7 @@ categories = ["memory-management", "api-bindings", "development-tools" ]
keywords = ["allocator", "jemalloc"]
repository = "https://github.com/tikv/jemallocator"
homepage = "https://github.com/tikv/jemallocator"
documentation = "https://docs.rs/tikv-jemalloc-ctl"
documentation = "https://docs.rs/jemalloc-ctl"
description = """
A safe wrapper over jemalloc's control and introspection APIs
"""
Expand All @@ -26,12 +26,12 @@ is-it-maintained-open-issues = { repository = "tikv/jemallocator" }
maintenance = { status = "actively-developed" }

[dependencies]
tikv-jemalloc-sys = { path = "../jemalloc-sys", version = "0.4.0" }
jemalloc-sys = { path = "../jemalloc-sys", version = "0.4.0" }
libc = { version = "0.2", default-features = false }
paste = "1"

[dev-dependencies]
tikv-jemallocator = { path = "..", version = "0.4.0" }
jemallocator = { path = "..", version = "0.4.0" }

[features]
default = []
Expand Down
16 changes: 8 additions & 8 deletions jemalloc-ctl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@

## Platform support

Supported on all platforms supported by the [`tikv-jemallocator`] crate.
Supported on all platforms supported by the [`jemallocator`] crate.

## Example

```no_run
use std::thread;
use std::time::Duration;
use tikv_jemalloc_ctl::{stats, epoch};
use jemalloc_ctl::{stats, epoch};
#[global_allocator]
static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
fn main() {
// Obtain a MIB for the `epoch`, `stats.allocated`, and
Expand Down Expand Up @@ -61,10 +61,10 @@ Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in `jemalloc-ctl` by you, as defined in the Apache-2.0 license,
shall be dual licensed as above, without any additional terms or conditions.

[`tikv-jemallocator`]: https://github.com/tikv/jemallocator
[`jemallocator`]: https://github.com/tikv/jemallocator
[travis]: https://travis-ci.com/tikv/jemallocator
[Travis-CI Status]: https://travis-ci.com/tikv/jemallocator.svg?branch=master
[Latest Version]: https://img.shields.io/crates/v/tikv-jemallocator.svg
[crates.io]: https://crates.io/crates/tikv-jemallocator
[docs]: https://docs.rs/tikv-jemallocator/badge.svg
[docs.rs]: https://docs.rs/tikv-jemallocator/
[Latest Version]: https://img.shields.io/crates/v/jemallocator.svg
[crates.io]: https://crates.io/crates/jemallocator
[docs]: https://docs.rs/jemallocator/badge.svg
[docs.rs]: https://docs.rs/jemallocator/
4 changes: 2 additions & 2 deletions jemalloc-ctl/src/arenas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ option! {
/// ```
/// #
/// # #[global_allocator]
/// # static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
/// # static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
/// #
/// # fn main() {
/// use tikv_jemalloc_ctl::arenas;
/// use jemalloc_ctl::arenas;
/// println!("number of arenas: {}", arenas::narenas::read().unwrap());
///
/// let arenas_mib = arenas::narenas::mib().unwrap();
Expand Down
4 changes: 2 additions & 2 deletions jemalloc-ctl/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ option! {
///
/// ```
/// # #[global_allocator]
/// # static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
/// # static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
/// #
/// # fn main() {
/// use tikv_jemalloc_ctl::config;
/// use jemalloc_ctl::config;
/// let malloc_conf = config::malloc_conf::mib().unwrap();
/// println!("default malloc conf: {}", malloc_conf.read().unwrap());
/// # }
Expand Down
2 changes: 1 addition & 1 deletion jemalloc-ctl/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ impl NonZeroT for i64 {

pub type NonZeroCInt = <c_int as NonZeroT>::T;

/// Errors of the `tikv_jemalloc_sys::mallct`-family of functions.
/// Errors of the `jemalloc_sys::mallct`-family of functions.
///
/// The `jemalloc-sys` crate: `mallctl`, `mallctlnametomib`, and `mallctlbymib``
/// functions return `0` on success; otherwise they return an error value.
Expand Down
4 changes: 2 additions & 2 deletions jemalloc-ctl/src/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
//!
//! ```
//! #[global_allocator]
//! static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
//! static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
//!
//! fn main() {
//! use tikv_jemalloc_ctl::{Access, AsName, Name, Mib};
//! use jemalloc_ctl::{Access, AsName, Name, Mib};
//! use libc::{c_uint, c_char};
//! let name = b"arenas.nbins\0".name();
//! let nbins: c_uint = name.read().unwrap();
Expand Down

0 comments on commit 161451b

Please sign in to comment.