[Python-Dev] Object creation hook (original) (raw)

"Martin v. Löwis" martin at v.loewis.de
Wed Jan 24 00:32:09 CET 2007


Kristján V. Jónsson schrieb:

I am trying to insert a hook into python enabling a callback for all just-created objects. The intention is to debug and find memory leaks, e.g. by having the hook function insert the object into a WeakKeyDictionary.

I'd like to point out that this isn't a python-dev question, but more appropriate for comp.lang.python (as it is of the "how do I x with Python?" kind).

I would use a debug build, and use sys.getobjects to determine all objects and find leaks.

Regards, Martin



More information about the Python-Dev mailing list