Skip to content

bpo-37537: Compute allocated blocks in _Py_GetAllocatedBlocks()#14680

Merged
nascheme merged 3 commits into
python:masterfrom
nascheme:obmalloc_no_allocated
Jul 10, 2019
Merged

bpo-37537: Compute allocated blocks in _Py_GetAllocatedBlocks()#14680
nascheme merged 3 commits into
python:masterfrom
nascheme:obmalloc_no_allocated

Conversation

@nascheme

@nascheme nascheme commented Jul 10, 2019

Copy link
Copy Markdown
Member

Keeping an account of allocated blocks slows down _PyObject_Malloc() and _PyObject_Free() by a measureable amount. Have _Py_GetAllocatedBlocks() iterate over the arenas to sum up the allocated blocks for pymalloc.

https://bugs.python.org/issue37537

Keeping an account of allocated blocks slows down _PyObject_Malloc()
and _PyObject_Free() by a measureable amount.  Have
_Py_GetAllocatedBlocks() iterate over the arenas to sum up the
allocated blocks for pymalloc.

@tim-one tim-one left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surprising! Good catch. I doubt this function is ever used outside of memory-leak detectors, so its speed is hard to care about. I'm just asking for a change to round the arena base address up to the first pool's actual address (which probably isn't really needed on Linux or Windows, but will be needed if pool sizes ever increase beyond the OS page size).

Comment thread Objects/obmalloc.c Outdated
Comment thread Objects/obmalloc.c Outdated
@bedevere-bot

Copy link
Copy Markdown

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

@nascheme

Copy link
Copy Markdown
Member Author

I have made the requested changes; please review again

@bedevere-bot

Copy link
Copy Markdown

Thanks for making the requested changes!

@methane, @tim-one: please review the changes made to this pull request.

@nascheme
nascheme merged commit 5d25f2b into python:master Jul 10, 2019
@bedevere-bot

Copy link
Copy Markdown

@nascheme: Please replace # with GH- in the commit message next time. Thanks!

@nascheme
nascheme deleted the obmalloc_no_allocated branch July 10, 2019 19:04
lisroach pushed a commit to lisroach/cpython that referenced this pull request Sep 10, 2019
…on#14680)

Keeping an account of allocated blocks slows down _PyObject_Malloc()
and _PyObject_Free() by a measureable amount.  Have
_Py_GetAllocatedBlocks() iterate over the arenas to sum up the
allocated blocks for pymalloc.
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
…on#14680)

Keeping an account of allocated blocks slows down _PyObject_Malloc()
and _PyObject_Free() by a measureable amount.  Have
_Py_GetAllocatedBlocks() iterate over the arenas to sum up the
allocated blocks for pymalloc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants