Closed ericwinger closed 1 week ago
I think this isn't a bug. The Connection only holds onto a reference to its Service instances while they are alive and while the Connection is open. The reference to the Service object can be weak or strong depending upon the type of Service and whether it is replicated.
When the Connection is closed, the Service instances continue to reference the Connection via their _connection
instance variable. The Connection will retain no references to any of the Services but because they reference the Connection, it will not be garbage collected until they are.
If there is a lingering reference to any Service instance, the Service will not get finalized. The Service and associated Connection will remain in memory. When you close a Connection, all references to that Connections' Services need to be cleared.
An RSR connection keeps finalization blocks for each of it's services. When the connection is closed, however, the connection doesn't get garbage collected until all of it's services are finalized because the finalization block holds a reference to the connection.
It seems that the finalization blocks can be cleared when the connection is closed.