Is there a way to get the number of active MailboxProcessors in a system?
I have implemented BTree using one MailboxProcessor per page, and want to check if I’m leaking any as the tree shrinks.
Note, I did this as a learning exercise, not with any notion it was a useful thing to implement.
MailboxProcessor is just a little class in the standard library, it isn’t intended to be a major architectural thing with metrics and monitoring across all the mailboxes. You can see the code for it here, it’s quite small.
fsharp/mailbox.fs at master · fsharp/fsharp (github.com)
I’d suggest just making each of your instances increment and decrement a counter (InterlockedIncrement() or even another MailboxProcessor based agent that you send add/remove messages to!)