From af108b5bda5bca009fa4e058579ed20a284096c8 Mon Sep 17 00:00:00 2001 From: bigsheeper Date: Wed, 8 Jun 2022 00:12:05 +0800 Subject: [PATCH] Add malloc_trim after reduce search result (#17423) Signed-off-by: bigsheeper --- internal/core/src/segcore/reduce_c.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/core/src/segcore/reduce_c.cpp b/internal/core/src/segcore/reduce_c.cpp index 9e11751080..2ef9aa7b1a 100644 --- a/internal/core/src/segcore/reduce_c.cpp +++ b/internal/core/src/segcore/reduce_c.cpp @@ -9,8 +9,11 @@ // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express // or implied. See the License for the specific language governing permissions and limitations under the License -#include +#ifndef __APPLE__ +#include +#endif +#include #include "Reduce.h" #include "common/CGoHelper.h" #include "common/QueryResult.h" @@ -84,4 +87,7 @@ DeleteSearchResultDataBlobs(CSearchResultDataBlobs cSearchResultDataBlobs) { } auto search_result_data_blobs = reinterpret_cast(cSearchResultDataBlobs); delete search_result_data_blobs; +#ifdef __linux__ + malloc_trim(0); +#endif }