Skip to content

Commit

Permalink
Update curl.cpp: reduce memory cache use (#2157)
Browse files Browse the repository at this point in the history
flush the file and clean the page cache when filepart download done
  • Loading branch information
tanguofu committed May 27, 2023
1 parent e7a364d commit 5b487f6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/curl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 5b487f6

Please sign in to comment.