async: Futures should release then closure memory after they are evaluated #19492
Labels
area-core-library
SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.
library-async
After a future has resolved a value, it has no need for the "then" closure.
e.g.
var fourPlus = new Future.value(4).then((four) => four + lastReferenceToALargeDataStructure);
// fourPlus is used throughout the program.
Above, the "then" closure is holding on to memory, but the future has already computed the value and will never call the closure again. The future should explicitly release the closure after it has the value.
The text was updated successfully, but these errors were encountered: