Skip to content

Memory leak when calling cothread.Spawn on Python>=3.11 #70

@ptsOSL

Description

@ptsOSL

To reproduce, install cothread>=2.19 on Python>=3.11. Run this test:

import cothread

def test():
    print("hi")
 
while True:
    cothread.Spawn(test)
    cothread.Yield()

And you should see your memory usage rapidly increase.

This is most likely caused by the change c32a5a8 which does not clean up after the cothread has finished.

I got the error with:

python
Python 3.11.11 (main, Dec 9 2024, 15:32:27) [GCC 8.5.0 20210514 (Red Hat 8.5.0-22)] on linux
Type "help", "copyright", "credits" or "license" for more information.

pip list
Package Version


cothread 2.20.0
dls_slow_feedbacks 1.1.0+4.g72b71bc.dirty
epicscorelibs 7.0.7.99.1.2a1
epicsdbbuilder 1.5
numpy 2.2.5
pip 22.3.1
pvxslibs 1.3.3
pytac 0.5.0
PyYAML 6.0.2
scipy 1.15.3
setuptools 65.5.1
setuptools_dso 2.12.2
softioc 4.6.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions