You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
LeakSanitizer reports leaked code object when running Cython #158963
Honestly I think it's too hard to investigate this from scratch. Can you first trim down the analysis and see if you can at least bisect the bad commit?
What does running with -X showrefcount output? I've seen very similar leak traces in the past (with valgrind), but I can't remember if they were just false positives.
If it is a real leak (meaning -X showrefcount displays something other than [0 refs, 0 blocks]), we'll also need a pure-CPython repro; SQLAlchemy (or one of its dependencies) might simply have a memory leak.
Note: Cython here is running as pure Python bytecode on 3.16 (no compiled .so C extensions of Cython are loaded), so the leaked PyCodeObject is retained inside CPython's own runtime/import path.
Yes, this issue is still relevant. #158963 is about the LeakSanitizer report on 3.15 and main (3.16). The 3.14 JIT segfault, with its standard-library-only reproducer, is a different bug tracked in #158961. For #158963, my reduced reproducer still requires Cython; I have not found one without third-party packages yet. Please remove the 3.14 label from this issue—it does not apply to #158963.
changed the title [-]LeakSanitizer reports leaked code object during SQLAlchemy editable build on 3.15 and main[/-][+]LeakSanitizer reports leaked code object when running Cython[/+]on Oct 21, 2026
Activity
picnixz commentedon Oct 7, 2026
Honestly I think it's too hard to investigate this from scratch. Can you first trim down the analysis and see if you can at least bisect the bad commit?
ZeroIntensity commentedon Oct 7, 2026
What does running with
-X showrefcountoutput? I've seen very similar leak traces in the past (with valgrind), but I can't remember if they were just false positives.If it is a real leak (meaning
-X showrefcountdisplays something other than[0 refs, 0 blocks]), we'll also need a pure-CPython repro; SQLAlchemy (or one of its dependencies) might simply have a memory leak.ashm-dev commentedon Oct 7, 2026
Here is a trimmed-down reproducer without SQLAlchemy, setuptools, or C compilation. It only requires
pip install Cython:Running
./python -X showrefcount bug.pyoutputs:Note: Cython here is running as pure Python bytecode on 3.16 (no compiled .so C extensions of Cython are loaded), so the leaked PyCodeObject is retained inside CPython's own runtime/import path.
ZeroIntensity commentedon Oct 7, 2026
Do you have a repro without any third party packages?
ashm-dev commentedon Oct 9, 2026
@ZeroIntensity I was able to find one for 3.14, but unfortunately not yet for main or 3.15—though I'm still looking!
picnixz commentedon Oct 10, 2026
Please update the issue title as well and the description properly, at least for 3.14
ashm-dev commentedon Oct 10, 2026
@picnixz As of 3.14, since I have a separate issue with Segfault, and it’s updated there.
picnixz commentedon Oct 10, 2026
Is this issue still relevant then?
ashm-dev commentedon Oct 10, 2026
Yes, this issue is still relevant. #158963 is about the LeakSanitizer report on 3.15 and main (3.16). The 3.14 JIT segfault, with its standard-library-only reproducer, is a different bug tracked in #158961. For #158963, my reduced reproducer still requires Cython; I have not found one without third-party packages yet. Please remove the
3.14label from this issue—it does not apply to #158963.picnixz commentedon Oct 10, 2026
Please first update the description.. Stale descriptions are useless. Is it still about editable build and sqlalchemy??
[-]LeakSanitizer reports leaked code object during SQLAlchemy editable build on 3.15 and main[/-][+]LeakSanitizer reports leaked code object when running Cython[/+]ashm-dev commentedon Oct 21, 2026
@picnixz Updated the title and description with the Cython reproducer.