Skip to content

Commit

Permalink
fix: fix a memory leak with autopipelining. (#1470)
Browse files Browse the repository at this point in the history
  • Loading branch information
TysonAndre committed Nov 24, 2021
1 parent e5615da commit f5d8b73
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/autoPipelining.ts
Expand Up @@ -45,6 +45,10 @@ function executeAutoPipeline(client, slotKey: string) {
client._autoPipelines.delete(slotKey);

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

// Perform the call
pipeline.exec(function (err, results) {
Expand Down

0 comments on commit f5d8b73

Please sign in to comment.