enthought / enthought/traits

Cached adapters do not allow adaptees to be garbage collected

Open
#169 0 comments 0 reactions 0 assignees View on GitHub
type: bug
Dominant language
Python
Stars
462
Forks
90
PR merge metrics
No merged PRs in 30d

Description

The caching functionality of the adaptation framework is a 1:1 port of the old traits.protocols code, and is provided mostly for backward compatibility. The problem with it is that the cache will not be cleared unless you take care of cleaning the ‘adaptee’ trait when your adapters are deleted.

If you cache the adaptation from adaptee to an adapter, the adapter is keeping a reference to the adaptee, and so the cache cannot be freed once the adaptee and the adapters disappear. WeakRefs to the adapters do not work, as one of the use cases is keeping adapter state across adaptation (so the adapter should stay around as long as the original adaptee is).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.