Skip to content

Commit

Permalink
fix(cubestore): Malloc trim is broken for docker (#2223)
Browse files Browse the repository at this point in the history
  • Loading branch information
paveltiunov committed Feb 27, 2021
1 parent a0f92e3 commit 5702cc4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions rust/cubestore/src/sys/malloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
///
/// Use this function after code that produces considerable amount of memory allocations that
/// **have been already freed**.
#[cfg(all(target_os = "linux", target_env = "gnu"))] // Musl doesnt support malloc_trim, probably only gnu has it.
#[cfg(all(target_os = "linux", not(target_env = "musl")))] // Musl doesnt support malloc_trim, probably only gnu has it.
pub fn trim_allocs() {
unsafe {
malloc_trim(0);
}
}

#[cfg(not(all(target_os = "linux", target_env = "gnu")))]
#[cfg(any(not(target_os = "linux"), target_env = "musl"))]
pub fn trim_allocs() {}

#[cfg(all(target_os = "linux", target_env = "gnu"))] // Musl doesnt support malloc_trim, probably only gnu has it.
#[cfg(all(target_os = "linux", not(target_env = "musl")))] // Musl doesnt support malloc_trim, probably only gnu has it.
extern "C" {
fn malloc_trim(pad: usize) -> i32;
}

0 comments on commit 5702cc4

Please sign in to comment.