Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak in dict.pop() #73080

Closed
mgedmin mannequin opened this issue Dec 7, 2016 · 3 comments
Closed

Memory leak in dict.pop() #73080

mgedmin mannequin opened this issue Dec 7, 2016 · 3 comments
Labels
3.7 (EOL) end of life interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@mgedmin
Copy link
Mannequin

mgedmin mannequin commented Dec 7, 2016

BPO 28894
Nosy @mgedmin, @zhangyangyu
Superseder
  • bpo-28147: Unbounded memory growth resizing split-table dicts
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2016-12-07.14:58:58.113>
    created_at = <Date 2016-12-07.14:47:11.557>
    labels = ['interpreter-core', '3.7']
    title = 'Memory leak in dict.pop()'
    updated_at = <Date 2016-12-07.14:58:58.110>
    user = 'https://github.com/mgedmin'

    bugs.python.org fields:

    activity = <Date 2016-12-07.14:58:58.110>
    actor = 'xiang.zhang'
    assignee = 'none'
    closed = True
    closed_date = <Date 2016-12-07.14:58:58.113>
    closer = 'xiang.zhang'
    components = ['Interpreter Core']
    creation = <Date 2016-12-07.14:47:11.557>
    creator = 'mgedmin'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 28894
    keywords = []
    message_count = 3.0
    messages = ['282623', '282624', '282626']
    nosy_count = 2.0
    nosy_names = ['mgedmin', 'xiang.zhang']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '28147'
    type = None
    url = 'https://bugs.python.org/issue28894'
    versions = ['Python 3.6', 'Python 3.7']

    @mgedmin
    Copy link
    Mannequin Author

    mgedmin mannequin commented Dec 7, 2016

    Run the following script with Python 3.6.0rc1:

        class O:
            pass
    
        o = O()
        for n in range(20):
            print(n)
            o.x = 42
            o.__dict__.pop('x', None)

    You can observe the memory usage of the Python process growing exponentially.

    E.g. in bash:

        ulimit -v 1000000    # don't push other processes into swap please
        python3.6 break.py
        0
        1
        2
        3
        4
        5
        6
        7
        8
        9
        10
        11
        Traceback (most recent call last):
          File "break.py", line 7, in <module>
            o.x = 42
        MemoryError

    @mgedmin mgedmin mannequin added 3.7 (EOL) end of life interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Dec 7, 2016
    @mgedmin
    Copy link
    Mannequin Author

    mgedmin mannequin commented Dec 7, 2016

    If you're curious where this happens in real life, py.test's CaptureManager.deactivate_funcargs() does

        self.__dict__.pop("_capfuncarg", None)

    and I found it by running 'tox -e py36' on https://github.com/mgedmin/eazysvn

    @zhangyangyu
    Copy link
    Member

    This is the same problem as bpo-28147.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life interpreter-core (Objects, Python, Grammar, and Parser dirs)
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant