Skip to content
Closed
Changes from all commits
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: 7 additions & 2 deletions js/signals/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1209,9 +1209,14 @@ describe("spawn retention", () => {
return heapStats().objectTypeCounts.Promise ?? 0;
};

// Settle each task before the next, like a per-group spawn. Spawning all at once would grow
// the task set through rehashes, and JSC leaves the old tables' keys in place: a stale
// conservative stack word pointing at one keeps ~8k dead promises alive.
const before = promises();
for (let i = 0; i < 10000; i++) effect.spawn(async () => {});
await settle();
for (let i = 0; i < 10000; i++) {
effect.spawn(async () => {});
await settle();
}
expect(promises() - before).toBeLessThan(100);
effect.close();
});
Expand Down