Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

PyThreadState andPyInterpreterState are not freed #99205

Closed
Assignees
brandtbucher
Labels
3.11only security fixes3.12only security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error
@zzzeek

Description

@zzzeek

The following test program gains about 10M per second under top, on Python 3.11 only (confirmed for all development stages: 3.11.0a4, 3.11.0b1, 3.11.0rc1, 3.11.0) . 3.10 shows no memory growth.

fromthreadingimportThreadwhileTrue:t1=Thread()t1.start()

For direct results, here's the same program using theresource module that I just saw used over at#98467:

fromthreadingimportThreadimportresourceprint("Before",resource.getrusage(resource.RUSAGE_SELF).ru_maxrss/1024,"MB")i=0whileTrue:i+=1t1=Thread()t1.start()ifi%10000==0:print(f"memory after{i} iterations:",resource.getrusage(resource.RUSAGE_SELF).ru_maxrss/1024,"MB",        )

The above program under Py 3.11.0 prints:

$ .venv-3.11/bin/python test5.py Before 8.14453125 MBmemory after 10000 iterations: 11.6875 MBmemory after 20000 iterations: 15.30078125 MBmemory after 30000 iterations: 18.65234375 MBmemory after 40000 iterations: 22.26171875 MBmemory after 50000 iterations: 25.87109375 MBmemory after 60000 iterations: 29.22265625 MBmemory after 70000 iterations: 32.83203125 MBmemory after 80000 iterations: 36.44140625 MBmemory after 90000 iterations: 39.78125 MBmemory after 100000 iterations: 43.390625 MB...

under Python 3.10 it prints:

$ .venv-3.10/bin/python test5.py Before 9.25 MBmemory after 10000 iterations: 9.46484375 MBmemory after 20000 iterations: 9.47265625 MBmemory after 30000 iterations: 9.47265625 MBmemory after 40000 iterations: 9.47265625 MBmemory after 50000 iterations: 9.47265625 MBmemory after 60000 iterations: 9.47265625 MBmemory after 70000 iterations: 9.47265625 MBmemory after 80000 iterations: 9.47265625 MB

the issue looks extremely similar to another one we just fixed in greenlet, over atpython-greenlet/greenlet#328, although this one is much more surprising. Issue#98467 might also be related.

Environment:

$ uname -aLinux photon3 5.17.14-200.fc35.x86_64 #1 SMP PREEMPT Thu Jun 9 14:02:42 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux$ python3Python 3.11.0 (main, Nov  5 2022, 23:27:22) [GCC 11.3.1 20220421 (Red Hat 11.3.1-3)] on linux

Metadata

Metadata

Assignees

Labels

3.11only security fixes3.12only security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp