> I already have posted a message about poison pills process, but I figured I would try and target my question more appropriately. I just want to ensure
> I don't have a memory leak when I take a actor tree out of service, but removing any reference to the first inbox in the tree from my application.
>
> If a mailbox is no longer getting messages and there is no longer a reference to the first mailbox in a actor tree, is there anything that continues to hold
> onto references to prevent garbage collection? I am still digging through the kilim code but thought I would ask.
>
>
>
> The mailbox and actors reference each other, so will that actually prevent them being garbage collected? It is a recursive reference and I am no
> garbage collector expert?
>
There's no magic. Your intuition is correct; the task and mailbox may refer to each other (and only during a get or a put), and will be collectively gc'd if there's no other referrer. Once a task is paused because of a get (for example), the task is added to the mailbox's 'sink', and the task holds on to the fiber. If no one's stored a ref to the mailbox, both the task and the mailbox will be silently gc'd.
You are also right that the scheduler only knows about runnable tasks, but not paused tasks.
> If they won't be garbage collected because they still reference each other, what is the best way to deal with that? Would I need to extend Mailbox
> to get access to the listener members so I can clear them out?
There's no need to do this.
"If there's a task waiting in the forest and there's no one to notice, does it exist"? Ancient philosophical issue.
--sirram