mirror of https://mirror.osredm.com/root/redis.git
Reclaim page cache memory used by the AOF file after loading (#13811)
We can reclaim page cache memory used by the AOF file after loading, since we don't read AOF again, corresponding to https://github.com/redis/redis/pull/11248 There is a test after loading 9.5GB AOF, this PR uses much less `buff/cache` than unstable. **Unstable** ``` $ free -m total used free shared buff/cache available Mem: 31293 16181 4562 13 10958 15111 Swap: 0 0 0 ``` **This PR** ``` $ free -m total used free shared buff/cache available Mem: 31293 15391 15854 13 439 15902 Swap: 0 0 0 ``` --------- Co-authored-by: debing.sun <debing.sun@redis.com>
This commit is contained in:
parent
714ea20fec
commit
191afb8903
|
@ -1725,7 +1725,10 @@ cleanup:
|
|||
if (fakeClient) freeClient(fakeClient);
|
||||
server.current_client = old_cur_client;
|
||||
server.executing_client = old_exec_client;
|
||||
int fd = dup(fileno(fp));
|
||||
fclose(fp);
|
||||
/* Reclaim page cache memory used by the AOF file in background. */
|
||||
if (fd >= 0) bioCreateCloseJob(fd, 0, 1);
|
||||
sdsfree(aof_filepath);
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue