Skip to content

Help to understand a leak report with non-obvious cycle #866

Answered by wjakob
adriendelsalle asked this question in Q&A
Discussion options

You must be logged in to vote

I am not 100% sure, these things are confusing to track down. In the past, I used objgraph to find the reference cycles.

It is possible that the class object captures some variables implicitly (like a lambda capture object in the case of function). Probably that includes the outer function, which may in turn depend on other things. It's likely that something references the module itself, which contains all of the other stuff.

Generally, when you create bindings for things that can capture arbitrary variables in Python, a tp_traverse and tp_clear are unavoidable.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@wjakob
Comment options

Answer selected by adriendelsalle
@adriendelsalle
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants