From 879437238fe9ebc201718813a9f6c52f8db41f69 Mon Sep 17 00:00:00 2001 From: Nikhil Sinha Date: Fri, 16 May 2025 00:38:01 -0400 Subject: [PATCH] fix: memory release issue: server does not release memory after query execution completes fix: malloc_trim function releases unused memory from the application back to the OS works only on the linux operating system --- Cargo.lock | 5 +++-- Cargo.toml | 1 + src/handlers/http/query.rs | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 279dbf16a..f5f1a0b4a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2900,9 +2900,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.169" +version = "0.2.172" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" +checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" [[package]] name = "libm" @@ -3487,6 +3487,7 @@ dependencies = [ "humantime", "humantime-serde", "itertools 0.14.0", + "libc", "num_cpus", "object_store", "once_cell", diff --git a/Cargo.toml b/Cargo.toml index a8763aa91..3a2c97cef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -121,6 +121,7 @@ static-files = "0.2" thiserror = "2.0" ulid = { version = "1.0", features = ["serde"] } xxhash-rust = { version = "0.8", features = ["xxh3"] } +libc = "0.2.172" [build-dependencies] cargo_toml = "0.21" diff --git a/src/handlers/http/query.rs b/src/handlers/http/query.rs index 368fe8b9c..158970791 100644 --- a/src/handlers/http/query.rs +++ b/src/handlers/http/query.rs @@ -150,6 +150,10 @@ pub async fn query(req: HttpRequest, query_request: Query) -> Result