On 11/28/2012 08:58 PM, Joachim Haga wrote: >>> Will the circular references "functionspace <-> >>> testfunction" be a problem for garbage collection? >> >> Yes. > > I am not familiar with the particulars here, but the circular > references are only a problem if the objects have custom deleters > (__del__ methods). Swig likes to generate (empty) __del__ methods, but > they can be disabled by the should-have-been-default flag > --noproxydel. Ok, nice to know. Also see: http://stackoverflow.com/questions/2428301/should-i-worry-about-circular-references-in-python for some nice references. It also seems like none of the classes implements __del__ so in theory we should be fine. The thread above do mention possible slowness in performance in these type of garbage collections, but I guess that would be for larger chain of circular references? You could also use weak refs I guess, or just implement the test/trial count discussed later in the thread. Johan > -j. > > On 28 November 2012 20:03, Johan Hake