# HG changeset patch # User Kim Alvefur # Date 1546136694 -3600 # Node ID 0dbb285f903edca5e8db751578b4fecfb1808933 # Parent 8132030ff04a7541a60f0e4eaa7f80b619b4fa3c util.promise: Remove references to callbacks after settling promise This is to help the garbage collector. diff -r 8132030ff04a -r 0dbb285f903e util/promise.lua --- a/util/promise.lua Sun Dec 30 03:20:37 2018 +0100 +++ b/util/promise.lua Sun Dec 30 03:24:54 2018 +0100 @@ -49,6 +49,9 @@ for _, cb in ipairs(cbs) do cb(value); end + -- No need to keep references to callbacks + promise._pending_on_fulfilled = nil; + promise._pending_on_rejected = nil; return true; end