Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/Effect/Aff.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ var Aff = function () {
var FIBER = "Fiber"; // Actual fiber reference
var THUNK = "Thunk"; // Primed effect, ready to invoke

// Error used for early cancelation on Alt branches.
// This is initialized here (rather than in the Fiber constructor) because
// otherwise, in V8, this Error object indefinitely hangs on to memory that
// otherwise would be garbage collected.
var early = new Error("[ParAff] Early exit");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good find. Any thoughts as to why this happens? Just curious.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would guess it has something to do with stack frames and traces or whatever.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<symbol> in Error is what is hanging onto the memory, whatever that is, and I do not know why Error is being referenced from the root. I figure it is some special debugging sauce in V8 being quirky.


function Aff(tag, _1, _2, _3) {
this.tag = tag;
this._1 = _1;
Expand Down Expand Up @@ -660,9 +666,6 @@ var Aff = function () {
var killId = 0;
var kills = {};

// Error used for early cancelation on Alt branches.
var early = new Error("[ParAff] Early exit");

// Error used to kill the entire tree.
var interrupt = null;

Expand Down