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 leaks detected with valgrind for python -V #80514

Closed
matrixise opened this issue Mar 17, 2019 · 9 comments
Closed

memory leaks detected with valgrind for python -V #80514

matrixise opened this issue Mar 17, 2019 · 9 comments
Assignees
Labels
3.8 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@matrixise
Copy link
Member

BPO 36333
Nosy @vstinner, @matrixise
PRs
  • bpo-36333: Fix leaks in pymain_init and _PyPreConfig_ReadFromArgv #12389
  • bpo-36333: Fix leak in _PyRuntimeState_Fini #12400
  • bpo-36333: Clarify fileutils.h documentation #12406
  • bpo-36301: Fix Py_Main() memory leaks #12420
  • bpo-36333, bpo-36356: Fix _PyEval_FiniThreads() #12432
  • Files
  • valgrind.log
  • valgrind-without-memory-leak.log
  • 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 = 'https://github.com/vstinner'
    closed_at = <Date 2019-03-19.23:57:14.461>
    created_at = <Date 2019-03-17.23:45:18.465>
    labels = ['interpreter-core', '3.8']
    title = 'memory leaks detected with valgrind for python -V'
    updated_at = <Date 2019-03-19.23:57:14.460>
    user = 'https://github.com/matrixise'

    bugs.python.org fields:

    activity = <Date 2019-03-19.23:57:14.460>
    actor = 'vstinner'
    assignee = 'vstinner'
    closed = True
    closed_date = <Date 2019-03-19.23:57:14.461>
    closer = 'vstinner'
    components = ['Interpreter Core']
    creation = <Date 2019-03-17.23:45:18.465>
    creator = 'matrixise'
    dependencies = []
    files = ['48213', '48214']
    hgrepos = []
    issue_num = 36333
    keywords = ['patch']
    message_count = 9.0
    messages = ['338147', '338148', '338149', '338185', '338191', '338288', '338342', '338351', '338424']
    nosy_count = 2.0
    nosy_names = ['vstinner', 'matrixise']
    pr_nums = ['12389', '12400', '12406', '12420', '12432']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue36333'
    versions = ['Python 3.8']

    @matrixise
    Copy link
    Member Author

    I have detected 3 memory leaks when I execute python -V with valgrind -> 162 bytes.

    The leaks do seem to be in pymain_init and in _PyPreConfig_ReadFromArgv (the string for the locale is not freed).

    Also _PyRuntimeState_Fini does not release the memory of the mutex on runtime->xidregistry.

    You can find the first status in the valgrind.log file (with the leaks).

    @matrixise matrixise added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Mar 17, 2019
    @matrixise
    Copy link
    Member Author

    The report of valgrind with no leaks.

    @matrixise matrixise added the 3.8 only security fixes label Mar 17, 2019
    @matrixise
    Copy link
    Member Author

    @vstinner I ping you because you are the main author for the new changes in the interpreter and the PyPreConfig part.

    @vstinner
    Copy link
    Member

    I assign the issue to myself, since I'm currently working on the code: bpo-36301.

    @vstinner vstinner self-assigned this Mar 18, 2019
    @matrixise
    Copy link
    Member Author

    I close the PR 12389 because it superseded by PR 12400 (only the fix for _PyRuntimeState_Fini).

    @matrixise matrixise assigned vstinner and unassigned vstinner Mar 18, 2019
    @vstinner
    Copy link
    Member

    New changeset c183444 by Victor Stinner in branch 'master':
    bpo-36301: Fix Py_Main() memory leaks (GH-12420)
    c183444

    @vstinner
    Copy link
    Member

    New changeset 943395f by Victor Stinner (Stéphane Wirtel) in branch 'master':
    bpo-36333: Fix leak _PyRuntimeState_Fini (GH-12400)
    943395f

    @vstinner
    Copy link
    Member

    New changeset a712679 by Victor Stinner in branch 'master':
    bpo-36333, bpo-36356: Fix _PyEval_FiniThreads() (GH-12432)
    a712679

    @vstinner
    Copy link
    Member

    "./python -V" no longer leaks, so I close the issue. See bpo-36356 for the follow-up.

    @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.8 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs)
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants