X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/a3e60027e7d4419971406c6da7d6e8accbcaf9b0..8df3dcada5e34c6a99666931ee6dcccd57685353:/src/rdb.c diff --git a/src/rdb.c b/src/rdb.c index b8e24ab6..589b536a 100644 --- a/src/rdb.c +++ b/src/rdb.c @@ -461,7 +461,8 @@ int rdbSaveBackground(char *filename) { if ((childpid = fork()) == 0) { /* Child */ if (server.vm_enabled) vmReopenSwapFile(); - close(server.fd); + if (server.ipfd > 0) close(server.ipfd); + if (server.sofd > 0) close(server.sofd); if (rdbSave(filename) == REDIS_OK) { _exit(0); } else { @@ -885,16 +886,16 @@ int rdbLoad(char *filename) { /* Flush data on disk once 32 MB of additional RAM are used... */ force_swapout = 0; - if ((redisEstimateRSS() - server.vm_max_memory) > 1024*1024*32) + if ((zmalloc_used_memory() - server.vm_max_memory) > 1024*1024*32) force_swapout = 1; /* If we have still some hope of having some value fitting memory * then we try random sampling. */ if (!swap_all_values && server.vm_enabled && force_swapout) { - while (redisEstimateRSS() > server.vm_max_memory) { + while (zmalloc_used_memory() > server.vm_max_memory) { if (vmSwapOneObjectBlocking() == REDIS_ERR) break; } - if (redisEstimateRSS() > server.vm_max_memory) + if (zmalloc_used_memory() > server.vm_max_memory) swap_all_values = 1; /* We are already using too much mem */ } }