A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2008-March/078309.html below:

[Python-Dev] nested classes leaking in compiler

[Python-Dev] nested classes leaking in compiler [Python-Dev] nested classes leaking in compilerChristian Heimes lists at cheimes.de
Sun Mar 30 16:29:42 CEST 2008
Amaury Forgeot d'Arc schrieb:
> The approach I used is a bit brute-force, but it may work for other
> reference leaks:
> - First write a big leaking script:
>     for x in xrange(100000): leaking_function()
> - Since memory usage does not increase dramatically, it's only a
> refcount problem - no new object every time.
> - Modify the Py_INCREF macro so that it generates a breakpoint in the
> debugger when the refcount is large:
>   On Windows, it is something like:
>      if (ob->refcount > 10000) { __asm int 3; }
>   (with gdb I think you may signal SIGUSR1)
> - carefully inspect the code each time the debugger stops.
>   Fortunately, many functions can be skipped: PyDict_SetItem and other
> bullet-proof parts of the code.
>   The 20th break was the good one: a lack of symmetry between
> Py_INCREF and Py_DECREF.

Nice! Can you write a short howto for the wiki? The idea is ingenious.

Christian
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4