Patch-Source: https://github.com/FGasper/p5-Promise-ES6/pull/16 Upstream-Issue: https://github.com/FGasper/p5-Promise-ES6/issues/14 -- From 127f56f78ef00bbf0b385f2a4a134b17fc08a427 Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Thu, 1 Aug 2024 11:53:55 +1000 Subject: [PATCH] break circular reference loop between @resolves and closures This solution works by breaking the loop between @resolves, and the closures the objects it contains, contain Fixes #14 --- t/race_async.t | 6 +++--- t/race_fail.t | 6 +++--- t/race_success.t | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/t/race_async.t b/t/race_async.t index fc0bd50..5791cf4 100644 --- a/t/race_async.t +++ b/t/race_async.t @@ -57,9 +57,9 @@ use Promise::ES6; waitpid $pid, 0; - # This appears to be needed to solve a garbage-collection problem - # that Perl 5.18 fixed but that persists with Devel::Cover. - splice @resolves if $^V lt 5.18.0 || $INC{'Devel/Cover.pm'}; + # break the circular reference loop between @resolves and + # the closures + @resolves = (); } done_testing(); diff --git a/t/race_fail.t b/t/race_fail.t index 7fa4681..1e7d3a3 100644 --- a/t/race_fail.t +++ b/t/race_fail.t @@ -59,9 +59,9 @@ use Promise::ES6; waitpid $pid, 0; - # This appears to be needed to solve a garbage-collection problem - # that Perl 5.18 fixed but that persists with Devel::Cover. - splice @resolves if $^V lt 5.18.0 || $INC{'Devel/Cover.pm'}; + # break the circular reference loop between @resolves and + # the closures + @resolves = (); } done_testing(); diff --git a/t/race_success.t b/t/race_success.t index 7552fbd..967f644 100644 --- a/t/race_success.t +++ b/t/race_success.t @@ -56,9 +56,9 @@ use Promise::ES6; waitpid $pid, 0; - # This appears to be needed to solve a garbage-collection problem - # that Perl 5.18 fixed but that persists with Devel::Cover. - splice @resolves if $^V lt 5.18.0 || $INC{'Devel/Cover.pm'}; + # break the circular reference loop between @resolves and + # the closures + @resolves = (); } done_testing();