https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101692
--- Comment #7 from Eugene Zhiganov <zed at lab127 dot karelia.ru> ---
(In reply to Eugene Zhiganov from comment #5)
> This rxMachines array is just for the purpose of holding references,
> since references in linked list are not counted at all by GC.
Maybe I am not right here...
Things a little bit more complicated.
Initially objects were created like this:
auto rxPool = new RestRoom();
for (int k = 0; k < maxClients; k++) {
auto sm = new RxSm(rxPool);
sm.run();
}
After the the loop 'sm' is out of scope
and all these just created instances
are marked for deletion I guess.
RxSm has 3 states, INIT, IDLE and WORK.
run() method calls enter function for INIT state.
In this function rx do some initalization
and send a message to self (message means
'now go to IDLE state').
A little bit later, when program enters event loop
and starts processing messages, that message
is processed, machine enters IDLE state,
where it puts itself into a pool like this:
void rxIdleEnter() {
rR.put(this);
// adds 'this' pointer to Slist
}
But at this moment the instance is already marked
for deletion... and hence reference in the list
is not counted either because of
* object was marked for deletion
or because of
* references in Slist are not counted at all (???)