dl l <ldlch...@gmail.com> writes:
> I understood call PyGC_collect to release object cycles. But in my python
> test code, seems there is NO reference cycle on the Simple object in the
> python test code. Why needs to call PyGC_Collect() here?
>
> =========================================================
>
> class Simple:
>      def __init__( self ):
>          print('Simple__init__')
>      def __del__( self ):
>          print('Simple__del__')
>
> simple = None
>
> def run():
>     global simple
>     simple = Simple()
>
> if __name__ == '__main__':
>       run()

I do not see a cycle in this example. Thus, maybe, Python itself
has introduced one (maybe via "__builtins__").

To further analyse the case, I would start by checking the "gc" module's
documentation to find out, whether it provides a way to get information
about the cycles it has found (and would have deleted if it had
not generated references for this analysis).

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to