rabbitmq / rabbitmq-objc-client

RabbitMQ client for Objective-C and Swift
https://rabbitmq.com
Other
242 stars 84 forks source link

Avoid RMQConnection leaks by adopting weak refs, take 2 #196

Closed michaelklishin closed 2 years ago

michaelklishin commented 2 years ago

for some important dependencies of allocated channels and RMQConnection itself.

In this client, RMQConnection auto-allocates a channel for the purpose of special "channel zero" (system communication in the protocol) purposes, and that leads to a loop of strong references that prevent RMQConnection instances from being released.

Contributed by @BarryDuggan in #194.

michaelklishin commented 2 years ago

This has introduced test failures that are basically nil pointers.

BarryDuggan commented 2 years ago

This has introduced test failures that are basically nil pointers.

Ok, I guess the memory graph in XCode will need be examined more closely.

The upshot of all of this is that we identified a memory issue and an area for improvement in the library which is good. I'll pick this up again tomorrow. Hopefully I can get the unit tests running so I can see the issues you do before I make any more suggestions.

michaelklishin commented 2 years ago

197 includes fewer weak references and passes all tests.

michaelklishin commented 2 years ago

We can incrementally add to #197 and re-run @BarryDuggan's allocation tests on one hand, and integration tests on the other.