Does marking a seq of objects with destructors as `acyclic` prevent memory leaks in cyclic references?
0 reputation · 21 Dec 2025, 04:11 UTC
The goal is to safely manage memory for a seq of objects that each define a =destroy destructor and may form reference cycles through their fields.
When using the default ORC garbage collector (--gc:orc), cycles containing seq or ref are not reclaimed automatically unless the type is marked with the acyclic pragma or the cycle collector is invoked manually. However, the documentation notes that acyclic suppresses cycle collection for the type, which can hide real leaks and may affect destructor ordering if the collector would have broken the cycle.
Does marking the seq type as acyclic guarantee that no memory leak occurs when the sequence participates in a cycle, or does it merely disable the collector and risk hiding leaks? Is there a recommended pattern (e.g., using DoublyLinkedList or explicit dealloc) that preserves deterministic destructor execution without leaks? How can one empirically verify that the chosen approach does not leak in long‑running server workloads?