Skip to content

Commit f5d8b73

Browse files
authored
fix: fix a memory leak with autopipelining. (#1470)
1 parent e5615da commit f5d8b73

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/autoPipelining.ts

+4
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ function executeAutoPipeline(client, slotKey: string) {
4545
client._autoPipelines.delete(slotKey);
4646

4747
const callbacks = pipeline[kCallbacks];
48+
// Stop keeping a reference to callbacks immediately after the callbacks stop being used.
49+
// This allows the GC to reclaim objects referenced by callbacks, especially with 16384 slots
50+
// in Redis.Cluster
51+
pipeline[kCallbacks] = null;
4852

4953
// Perform the call
5054
pipeline.exec(function (err, results) {

0 commit comments

Comments
 (0)