From 5b487f651aad9661a6e7d206b7404ebe47c7680a Mon Sep 17 00:00:00 2001 From: Tan Guofu <87045830+tanguofu@users.noreply.github.com> Date: Sat, 27 May 2023 18:15:47 +0800 Subject: [PATCH] Update curl.cpp: reduce memory cache use (#2157) flush the file and clean the page cache when filepart download done --- src/curl.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/curl.cpp b/src/curl.cpp index a5117b3..2ae9fa8 100644 --- a/src/curl.cpp +++ b/src/curl.cpp @@ -703,7 +703,12 @@ size_t S3fsCurl::DownloadWriteCallback(void* ptr, size_t size, size_t nmemb, voi } pCurl->partdata.startpos += totalwrite; pCurl->partdata.size -= totalwrite; - + + // flush the file and clean the page cache + if (pCurl->partdata.size == 0){ + fdatasync(pCurl->partdata.fd); + } + return totalwrite; }