On Monday, 13 September 2021 at 18:42:47 UTC, Steven
Schveighoffer wrote:
And you are registering your signals using the `+=` operator.
That was a sort of exercise with operator overloading.
Now, with your stopper code that you showed, it looks like you
are storing the reference to stopper right on the main stack
frame. This *should* prevent those from being destroyed, since
Stopper has a reference to both signals.
Exactly - this is the main point of my confusion.
On my expectation, GC should not mark those as unreferenced.
Also, notice those dynamic arrays
void main(string[] args) {
RxSm[] rxMachines;
auto rxPool = new RestRoom();
foreach (k; 0 .. nConnections) {
auto sm = new RxSm(rxPool);
rxMachines ~= sm;
sm.run();
}
rxMachines (and alike) are not needed by the prog itself,
they are just to keep references for GC.