Skip to content

Commit 42da72b

Browse files
committed
Initial commit
0 parents  commit 42da72b

File tree

7 files changed

+42
-0
lines changed

7 files changed

+42
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/target
2+
**/*.rs.bk
3+
Cargo.lock

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "c_src/mimalloc"]
2+
path = c_src/mimalloc
3+
url = https://github.com/microsoft/mimalloc

Cargo.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[package]
2+
name = "mimalloc"
3+
version = "0.1.0"
4+
authors = ["Octavian Oncescu <[email protected]>"]
5+
edition = "2018"
6+
7+
[dependencies]
8+
9+
[build-dependencies]
10+
cmake = "0.1"

build.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
use cmake::Config;
2+
3+
fn main() {
4+
let dst = Config::new("c_src/mimalloc")
5+
.define("SECURE", "ON")
6+
.build();
7+
println!("cargo:rustc-link-search=native={}", dst.display());
8+
//println!("cargo:rustc-link-lib=static=libmimalloc");
9+
}

c_src/mimalloc

Submodule mimalloc added at 9122269

src/ffi.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Copyright 2019 Octavian Oncescu
2+

src/lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2019 Octavian Oncescu
2+
3+
use std::alloc::{GlobalAlloc, Layout, alloc};
4+
use std::ptr::null_mut;
5+
use ffi::*;
6+
7+
pub struct MimAlloc;
8+
9+
unsafe impl GlobalAlloc for MimAlloc {
10+
unsafe fn alloc(&self, _layout: Layout) -> *mut u8 { null_mut() }
11+
unsafe fn dealloc(&self, _ptr: *mut u8, _layout: Layout) {}
12+
}
13+
14+
mod ffi;

0 commit comments

Comments
 (0)