嗯,我想我找到了問題。這似乎是一個多線程應用程序中的inspect模塊和底層C代碼的問題。具有上述代碼的模塊正在從不同的線程中導入。第二張圖指出了這個問題。
在第三節點向下此處列出的function
是inspect.getmodule()。我無法適應這一切,不得不做一些裁剪。
(Pdb) objgraph.at(3510928)
<cell at 0x359290: dict object at 0x3849c0>
而且字典裏面所有的幀
(Pdb) objgraph.at(0x3849c0)
{(<frame object at 0x97a288>, '/lib/python26.zip/logging/__init__.py'): <module 'logging' from '/lib/python26.zip/logging/__init__.py'>,
(<frame object at 0x896288>, '/lib/python26.zip/logging/__init__.py'): <module 'logging' from '/lib/python26.zip/logging/__init__.py'>,
(<frame object at 0xa621b0>, '/lib/python26.zip/logging/__init__.py'): <module 'logging' from '/lib/python26.zip/logging/__init__.py'>,
(<frame object at 0x11266e8>, '/lib/python26.zip/logging/__init__.py'): <module 'logging' from '/lib/python26.zip/logging/__init__.py'>,
...}
,如果你得到所有這些幀的外框
(Pdb) inspect.getouterframes(objgraph.at(0x97a288))
[(<frame object at 0x97a288>, '/lib/python26.zip/logging/__init__.py', 1028, 'debug', [' self._log(DEBUG, msg, args, **kwargs)\n'], 0),
(<frame object at 0x794040>, '/lib/python26.zip/logging/__init__.py', 1505, 'debug', [' root.debug(*((msg,)+args), **kwargs)\n'], 0),
(<frame object at 0x794e58>, '/mmc/src/core/controller/main.py', 1046, '__startCharge', [' self.chargeLock.release()\n'], 0),
(<frame object at 0x5c4260>, '/mmc/src/core/controller/main.py', 1420, 'watchScheduleStartChargeCondition', [' ret = self.__startCharge(0, eventCode=eventCode)\n'], 0),
(<frame object at 0x5c0dd0>, '/home/ephibian/Python2/_install/lib/python2.6/threading.py', 484, 'run', None, None),
(<frame object at 0x5c3b48>, '/home/ephibian/Python2/_install/lib/python2.6/threading.py', 532, '__bootstrap_inner', None, None),
(<frame object at 0x218170>, '/home/ephibian/Python2/_install/lib/python2.6/threading.py', 504, '__bootstrap', None, None)]
它們都指向在穿線__bootstrap方法。我可能在這裏錯誤的軌道上,但這些框架中的某些框架的背景遠不及我所稱的我發佈的方法。
你對退貨rv做了什麼? – 2010-11-04 01:35:00
gc.set_debug(gc.DEBUG_LEAK)顯示什麼?您應該在其輸出中看到泄漏的對象。 – dcolish 2010-11-04 03:14:21
我甚至沒有意識到我可以做到這一點,我必須在文檔中對其進行掃描。當我回到電腦時,我會看到明天說的話 – Falmarri 2010-11-04 03:30:50