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

_tracemalloc: remove pointer_t type #84789

Closed
vstinner opened this issue May 12, 2020 · 7 comments
Closed

_tracemalloc: remove pointer_t type #84789

vstinner opened this issue May 12, 2020 · 7 comments
Labels
3.9 only security fixes stdlib Python modules in the Lib dir

Comments

@vstinner
Copy link
Member

BPO 40609
Nosy @vstinner
PRs
  • bpo-40609: Rewrite how _tracemalloc handles domains #20059
  • bpo-40609: Remove _Py_hashtable_t.key_size #20060
  • bpo-40609: Add destroy functions to _Py_hashtable #20062
  • bpo-40609: _tracemalloc allocates traces #20064
  • bpo-40609: _Py_hashtable_t values become void* #20065
  • 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 2020-05-14.01:12:44.737>
    created_at = <Date 2020-05-12.22:47:15.350>
    labels = ['library', '3.9']
    title = '_tracemalloc: remove pointer_t type'
    updated_at = <Date 2020-05-14.01:12:44.735>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2020-05-14.01:12:44.735>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-05-14.01:12:44.737>
    closer = 'vstinner'
    components = ['Library (Lib)']
    creation = <Date 2020-05-12.22:47:15.350>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 40609
    keywords = ['patch']
    message_count = 7.0
    messages = ['368747', '368750', '368753', '368754', '368755', '368757', '368812']
    nosy_count = 1.0
    nosy_names = ['vstinner']
    pr_nums = ['20059', '20060', '20062', '20064', '20065']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue40609'
    versions = ['Python 3.9']

    @vstinner
    Copy link
    Member Author

    In bpo-26588, I modified the _tracemalloc module to support tracing memory allocations in multiple "domains" for numpy. I modified hashtable.c to support keys larger than void*, and I modified _tracemalloc.c to use a new pointer_t structure which is made of (domain: unsigned int, ptr: void*).

    These changes made hashtable.c way more complicated than what it should be. I would like to reuse hashtable.c in more places. I am working on a change to remove the pointer_t type from _tracemalloc.c, and instead use a hash table for traces of domains other than the default domain (0). The new hash table maps a domain to a hash table: traces of a domain.

    tracemalloc_traces remains the default hash table for traces of the default domain. Since it's the most common case, it doesn't go through the new hash table.

    @vstinner vstinner added 3.9 only security fixes stdlib Python modules in the Lib dir labels May 12, 2020
    @vstinner
    Copy link
    Member Author

    New changeset 9e2ca17 by Victor Stinner in branch 'master':
    bpo-40609: Rewrite how _tracemalloc handles domains (GH-20059)
    9e2ca17

    @vstinner
    Copy link
    Member Author

    New changeset f9b3b58 by Victor Stinner in branch 'master':
    bpo-40609: Remove _Py_hashtable_t.key_size (GH-20060)
    f9b3b58

    @vstinner
    Copy link
    Member Author

    New changeset 2d0a3d6 by Victor Stinner in branch 'master':
    bpo-40609: Add destroy functions to _Py_hashtable (GH-20062)
    2d0a3d6

    @vstinner
    Copy link
    Member Author

    New changeset d95bd42 by Victor Stinner in branch 'master':
    bpo-40609: _tracemalloc allocates traces (GH-20064)
    d95bd42

    @vstinner
    Copy link
    Member Author

    New changeset 5b0a303 by Victor Stinner in branch 'master':
    bpo-40609: _Py_hashtable_t values become void* (GH-20065)
    5b0a303

    @vstinner
    Copy link
    Member Author

    I modified _Py_hashtable_t to remove key_size and data_size: keys are now always "void *" and values are now always "void *".

    See also bpo-40602: Move Modules/hashtable.h to Include/internal/pycore_hashtable.h.

    @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.9 only security fixes stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant