如何看待gc.garbage?

时间:2014-02-24 09:20:14

标签: python python-3.x garbage-collection ctypes

我正在测试内存泄漏,并且没有任何关于这些垃圾的线索来自

<class 'tuple'>,(<class '_ctypes.Array'>,)
<class '_ctypes.PyCArrayType'>,<class 'ctypes.c_char_Array_16'>
<class 'getset_descriptor'>,<attribute '__dict__' of 'c_char_Array_16' objects>
<class 'getset_descriptor'>,<attribute '__weakref__' of 'c_char_Array_16' objects>
<class 'tuple'>,(<class 'ctypes.c_char_Array_16'>, <class '_ctypes.Array'>, <class '_ctypes._CData'>, <class 'object'>)
<class 'StgDict'>,{'__doc__': None, '__weakref__': <attribute '__weakref__' of 'c_char_Array_16' objects>, '__dict__': <attribute '__dict__' of 'c_char_Array_16' objects>, '_type_': <class 'ctypes.c_char'>, 'raw': <attribute 'raw' of 'c_char_Array_16' objects>, 'value': <attribute 'value' of 'c_char_Array_16' objects>, '__module__': 'ctypes', '_length_': 16}
<class 'getset_descriptor'>,<attribute 'raw' of 'c_char_Array_16' objects>
<class 'getset_descriptor'>,<attribute 'value' of 'c_char_Array_16' objects>

这是我用于打印消息的内容

    strs = []
    for x in gc.garbage:
        try:
            strs.append(str(type(x))+','+str(x))
        except Exception as e:
            print(e)
    print('\n'.join(strs))

我想输入元组的内容,任何机会吗?

0 个答案:

没有答案