Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
R
rust-rocksdb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangzongwu
rust-rocksdb
Commits
9603a845
Commit
9603a845
authored
Aug 07, 2019
by
Wu Jiayu
Committed by
Connor
Aug 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix jemalloc allocator (#332)
* fix memory allocator
parent
cf083fa6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
4 deletions
+8
-4
Cargo.toml
librocksdb_sys/Cargo.toml
+2
-1
build.rs
librocksdb_sys/build.rs
+1
-0
lib.rs
librocksdb_sys/src/lib.rs
+3
-1
rocksdb.rs
src/rocksdb.rs
+1
-1
rocksdb_options.rs
src/rocksdb_options.rs
+1
-1
No files found.
librocksdb_sys/Cargo.toml
View file @
9603a845
...
...
@@ -25,8 +25,9 @@ cc = "1.0.3"
cmake
=
"0.1"
[dependencies.jemalloc-sys]
version
=
"
>=
0.1.8"
version
=
"0.1.8"
optional
=
true
features
=
["unprefixed_malloc_on_supported_platforms"]
[dependencies.libz-sys]
version
=
"1.0.25"
...
...
librocksdb_sys/build.rs
View file @
9603a845
...
...
@@ -80,6 +80,7 @@ fn build_rocksdb() -> Build {
let
mut
cfg
=
Config
::
new
(
"rocksdb"
);
if
cfg!
(
feature
=
"jemalloc"
)
&&
NO_JEMALLOC_TARGETS
.iter
()
.all
(|
i
|
!
target
.contains
(
i
))
{
cfg
.register_dep
(
"JEMALLOC"
)
.define
(
"WITH_JEMALLOC"
,
"ON"
);
println!
(
"cargo:rustc-link-lib=static=jemalloc"
);
}
if
cfg!
(
feature
=
"portable"
)
{
cfg
.define
(
"PORTABLE"
,
"ON"
);
...
...
librocksdb_sys/src/lib.rs
View file @
9603a845
...
...
@@ -354,7 +354,9 @@ extern "C" {
)
->
*
mut
Options
;
// Memory Allocator
pub
fn
crocksdb_jemalloc_nodump_allocator_create
()
->
*
mut
DBMemoryAllocator
;
pub
fn
crocksdb_jemalloc_nodump_allocator_create
(
err
:
*
mut
*
mut
c_char
,
)
->
*
mut
DBMemoryAllocator
;
pub
fn
crocksdb_memory_allocator_destroy
(
allocator
:
*
mut
DBMemoryAllocator
);
// Cache
...
...
src/rocksdb.rs
View file @
9603a845
...
...
@@ -2386,7 +2386,7 @@ impl MemoryAllocator {
pub
fn
new_jemalloc_memory_allocator
()
->
Result
<
MemoryAllocator
,
String
>
{
unsafe
{
let
allocator
=
MemoryAllocator
{
inner
:
ffi_try!
(
crocksdb_
ffi
::
crocksdb_
jemalloc_nodump_allocator_create
()),
inner
:
ffi_try!
(
crocksdb_jemalloc_nodump_allocator_create
()),
};
Ok
(
allocator
)
}
...
...
src/rocksdb_options.rs
View file @
9603a845
...
...
@@ -1878,7 +1878,7 @@ impl LRUCacheOptions {
}
}
pub
fn
set_memory_allocator
(
&
mut
self
,
allocator
:
&
MemoryAllocator
)
{
pub
fn
set_memory_allocator
(
&
mut
self
,
allocator
:
MemoryAllocator
)
{
unsafe
{
crocksdb_ffi
::
crocksdb_lru_cache_options_set_memory_allocator
(
self
.inner
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment