Use weakref for change cache
The change cache is used to holf references to active Change objects
so that if something about them changes, the connection driver can
immediately update the data in memory and all enqueued items, etc,
will reflect the new data (because each logical change has a single
Change object that they reference).
However, once these objects are no longer referenced by any items
in pipelines or pending events, we don't need to keep them in the
cache. We used to manually prune the cache, but that was difficult
and we stopped doing it some time ago. Currently, this is a slow
but intentional memory leak.
Instead, let the python GC handle it for us by using weak references
to the Change objects in the cache. Once the only references to
these objects are the cache itself, they will be discarded.
Change-Id: Id659888a41dd60b7e72e891a47f1f742c30d0cc4
5 files changed