gc.get_objects()

Oscar Benjamin oscar.j.benjamin at gmail.com
Mon Sep 17 13:43:06 EDT 2012


On 2012-09-17, Matteo Boscolo <matteo.boscolo at boscolini.eu> wrote:
> from my gc.get_object()
> I extract the sub system of the object that I would like to delete:
>
> this is the object:
> Class name 
> win32com.gen_py.F4503A16-F637-11D2-BD55-00500400405Bx0x1x0.ITDProperty.ITDProperty
> that is traked and the reference are:
> get_referents >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> 
> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> 
> >>>>>>>>>>>>
> RefCount 5
><type 'tuple'> >>>>  (<class win32com.client.DispatchBaseClass at 
> 0x026ACB58>,)
> RefCount 5
><type 'dict'> >>>>  '__int__': <function __int__ at 0x03A50770>, 
> '__module__': 'win32com.gen_py.F45
> RefCount 8
><type 'str'> >>>>  ITDProperty
> RefCount 9
><type 'function'> >>>>  <function __getattr__ at 0x026C2630>
> RefCount 9
><type 'function'> >>>>  <function __setattr__ at 0x026C2670>
> get_referrers >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> 
> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> 
> >>>>>>>>>>>>
> RefCount 15
><type 'dict'> >>>>  'python_version': 34014192, 'defaultUnnamedArg': 
><PyOleEmpty object at 0x00447E
> RefCount 6
><type 'list'> >>>>  <class 
> win32com.gen_py.F4503A16-F637-11D2-BD55-00500400405Bx0x1x0.ITDProperty.I
> RefCount 4
><type 'list'> >>>>  (u'ItemsListCreator', u'trick', u'pVal'), (3, 49, 
> '0', None), (16393, 10, None,
> RefCount 4
><type 'frame'> >>>>  <frame object at 0x029721D8>
> RefCount 7
><type 'frame'> >>>>  <frame object at 0x02760148>
> RefCount 5
><type 'dict'> >>>> '{39AAEA35-F71F-11D2-BD59-00500400405B}': <class 
> win32com.gen_py.F4503A16-F637-
>
> how can I understand how to clean up this situation or were are the 
> references that I need to delete ?
>
>  From the cad non python script I call an in process python com object, 
> and before coming back to the cad application I need to clean up all com 
> reference, because if I do not do that I corrupt the cad application .
>
> so I urgently need to clean up all reference before coming back to the 
> cad application.
>
> any idea?
>

http://mg.pov.lt/objgraph/
http://mg.pov.lt/blog/hunting-python-memleaks.html

I have previously used the code from one of the links above to hunt down a
reference leak. It gives a graphical view of the alive references which helps
to locate the source of the ref leak.

Oscar




More information about the Python-list mailing list