Re: sip: Accessing members results in incorrect/missing data
Phil Thompson <[email protected]>
| Newsgroups | gmane.comp.python.pyqt-pykde |
|---|---|
| Message-ID | <[email protected]> |
On 22/01/2020 13:57, MatthijsBurgh wrote: > The first changeset already fixed the issue. > > The newer changeset creates the situation as desribed in > http://python.6.x6.nabble.com/sip-Accessing-members-results-in-incorrect-missing-data-tp5266521p5266740.html, > it looks like the release function isn't called anymore. I thought > Python GC > was able to break up circular references, but it looks like it isn't > happening. > > By running the following code: > ``` > v = Vector(1,2,3) > R = Rotation() > F = Frame(R,v) > v2 = F.p > v3 = Frame(F).p > v3 = Vector(2,3,4) > ``` > The `release_Frame` is called(print shows up) after the second `v3` > assignment when using your first changeset, but the print doesn't show > up > with your second changeset, today's one. > > So to me it looks like this will cause a memory leak. In my own test cases the cycle is broken. Have you run gc.collect()? If you print out the reference counts to they look correct? > Side note: I would prefer the usage of a specific key for the member > reference to the containing class. > I don't think using the same key for both references will cause a > problem > with overwriting. As a class can't contain a member of the same type, > only a > member as a pointer to the same type. In which case, the reference > isn't > kept, if I understand the code correct. There can be a problem (now fixed) if the type of the variable is defined in a different module from the type of the container. Phil _______________________________________________ PyQt mailing list [email protected] https://www.riverbankcomputing.com/mailman/listinfo/pyqt