Fix issue where GC is not free'd until a BGSAVE

Former-commit-id: 38523e6b508cf5f4b40c178dfe98554abea8f6bd
This commit is contained in:
John Sully 2021-04-07 17:30:59 +00:00
parent 14250faddd
commit ea2bbfb5c1

View File

@ -2450,6 +2450,16 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
g_pserver->ilockRingHead = 0; g_pserver->ilockRingHead = 0;
}); });
run_with_period(10) {
// Server threads don't free the GC, but if we don't have a
// a bgsave or some other async task then we'll hold onto the
// data for too long
g_pserver->asyncworkqueue->AddWorkFunction([]{
auto epoch = g_pserver->garbageCollector.startEpoch();
g_pserver->garbageCollector.endEpoch(epoch);
});
}
g_pserver->cronloops++; g_pserver->cronloops++;
return 1000/g_pserver->hz; return 1000/g_pserver->hz;
} }