Skip to content

upstream snmalloc-rs as part of snmalloc #744

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Rust

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

env:
CARGO_TERM_COLOR: always

jobs:
build:

runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, macos-14, macos-15, ubuntu-latest]
rust: [stable, nightly]
steps:
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: update dependency
run: |
if bash -c 'uname -s | grep 'Linux' >/dev/null'; then
sudo apt-get update -y && sudo apt-get --reinstall install -y libc6-dev
fi
shell: bash
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --all
- name: Run tests debug
run: cargo test --all --features debug
- name: Run tests check
run: cargo test --all --features check
- name: Run tests build_cc
run: cargo test --all --features "build_cc usecxx17"
- name: Run tests native-cpu
run: cargo test --all --features native-cpu
- name: Run tests local_dynamic_tls
run: cargo test --all --features local_dynamic_tls
- name: Run tests lto
run: cargo test --all --features lto
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@

# cache dirs
.cache

# rust related
/target/
/Cargo.lock
6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[workspace]
resolver = "2"
members = [
"rust/snmalloc-sys",
"rust/snmalloc-rs"
]
168 changes: 168 additions & 0 deletions rust/snmalloc-rs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
## Changelog

### 0.3.8

- Tracking upstream to match version 0.7.1
- Recommended to upgrade from 0.3.7 to get an important bug fix.

### 0.3.7

- Tracking upstream to match version 0.7

### 0.3.4
- Tracking upstream to match version 0.6.2

### 0.3.3
- Tracking upstream to fix Linux PAL typo.

### 0.3.2
- Tracking upstream to enable old Linux variants.

### 0.3.1
- Fixes `build_cc` feature (broken in 0.3.0 release).
- Fixes `native-cpu` feature (broken in 0.3.0 release).

### 0.3.0
- Release to follow upstream 0.6.0
- **upstream** Major redesign of the code to improve performance and
enable a mode that provides strong checks against corruption.

### 0.3.0-beta.1

- Beta release to support snmalloc 2

### 0.2.28
- Deprecation of `cache-friendly`
- Use exposed `alloc_zeroed` from `snmalloc`
- **upstream** changes of remote communication, corruption detection and compilation flag detection.

### 0.2.27

- Reduction of libc dependency
- **upstream** Windows 7 and windows 8 compatibility added
- **upstream** Option to use C++20 standards if available
- **upstream** Preparations of cherification (heavy refactors of the structure)
- **upstream** Cold routine annotations

### 0.2.26

- **upstream** Building adjustment
- option of cc crate as build feature, only c compiler needed, no cmake required
- Addition of dynamic local TLS option

### 0.2.25

- **upstream** Apple M1 support
- **upstream** Building adjust
- non-allocation tracking functions

### 0.2.24

- **upstream** update to use a more efficient power of 2 check
- fix msvc support w/ crt-static

### 0.2.23

- **upstream** fix external pagemap usage

### 0.2.22

- **upstream** avoid amplification when routing
- **upstream** remotely store sizeclass
- **upstream** limit flat pagemap size
- **upstream** limit medium slab header
- **upstream** solaris support fix

### 0.2.21

- **upstream** bug fix for using failing to initialise meta-data

### 0.2.20

- **upstream** pass through Haiku build fix.
- **upstream** fix typo in macro definition for 16MiB shared library shim.
- **upstream** DragonFly support (userland).
- **upstream** natural alignment for USE_MALLOC
- **upstream** fix bug in pagemap when index has many level
- **upstream** add constexpr annotation to align_up/down.

### 0.2.19

- **upstream** stats
- **upstream** PAL updates and concepts
- **upstream** ddd constexpr annotation to align_up/down
- change macOS CI to follow xcode 12

### 0.2.18

- add msvc flag /EHsc to fix warning C4530

### 0.2.17

- **upstream** add backoff for large reservation
- **upstream** default chunk configuration to 1mib
- add new feature flags

### 0.2.16

- **upstream** New implementation of address space reservation leading to
- better integration with transparent huge pages; and
- lower address space requirements and fragmentation.
- Notice MinGW broken state

### 0.2.15

- **upstream** fix VS2019 build
- **upstream** fix wrong realloc behavior and performance issue

### 0.2.14

- **upstream** refactor ptr representation.
- **upstream** improve for more targets and architectures.
- seperate native CPU feature

### 0.2.13

- **upstream** large realloc fix and minor updates

### 0.2.12

- improve mingw support

### 0.2.11

- add android support
- **upstream** support x86
- **upstream** support android
- **upstream** fix callback

### 0.2.10

- follow upstream 0.4.0
- **upstream** defense TLS teardown
- **upstream** adjust GCC warning
- **upstream** other release optimizations

### 0.2.9

- **upstream** fix OpenEnclave
- **upstream** adjust remote batch size (performance improved dramatically, see [benchmark](https://github.com/microsoft/snmalloc/pull/158#issuecomment-605816017)
- **upstream** improve slow path performance for allocation

### 0.2.8

- More CI (**ARM64 on QEMU**)
- **upstream** ARM(32/64) support
- **upstream** x86-SGX support

### 0.2.7

- partially fixed `mingw`
- **upstream** remote dealloc refactor (higher performance)
- **upstream** remove extra assertions

### 0.2.6

- fix `macos`/`freebsd ` support
- add more ci tests
- mark the `mingw` problem
32 changes: 32 additions & 0 deletions rust/snmalloc-rs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[package]
name = "snmalloc-rs"
version = "0.3.8"
authors = ["schrodingerzhu <[email protected]>"]
edition = "2021"
license = "MIT"
description = "rust bindings of snmalloc."
keywords = ["snmalloc", "allocator"]
categories = ["memory-management", "api-bindings"]
homepage = "https://github.com/microsoft/snmalloc"
repository = "https://github.com/SchrodingerZhu/snmalloc-rs"
readme = "README.md"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
snmalloc-sys = { version = "0.3.8", path = "../snmalloc-sys", default-features = false }

[features]
default = ["snmalloc-sys/build_cmake", "snmalloc-sys/usewait-on-address"]
build_cc = ["snmalloc-sys/build_cc"]
qemu = ["snmalloc-sys/qemu"]
debug = ["snmalloc-sys/debug"]
android-lld = ["snmalloc-sys/android-lld"]
native-cpu = ["snmalloc-sys/native-cpu"]
local_dynamic_tls = ["snmalloc-sys/local_dynamic_tls"]
win8compat = ["snmalloc-sys/win8compat"]
usecxx17 = ["snmalloc-sys/usecxx17"]
check = ["snmalloc-sys/check"]
lto = ["snmalloc-sys/lto"]
notls = ["snmalloc-sys/notls"]
stats = ["snmalloc-sys/stats"]
usewait-on-address = ["snmalloc-sys/usewait-on-address"]
21 changes: 21 additions & 0 deletions rust/snmalloc-rs/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 SchrodingerZhu

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading
Loading