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

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

Merged
merged 3 commits into from Jul 10, 2019

Conversation

@nascheme
Copy link
Member

nascheme commented Jul 10, 2019

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 self-requested a review Jul 10, 2019
Copy link
Member

tim-one left a comment

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).

Objects/obmalloc.c Outdated Show resolved Hide resolved
Objects/obmalloc.c Outdated Show resolved Hide resolved
@bedevere-bot

This comment has been minimized.

Copy link

bedevere-bot commented Jul 10, 2019

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

@nascheme

This comment has been minimized.

Copy link
Member Author

nascheme commented Jul 10, 2019

I have made the requested changes; please review again

@bedevere-bot

This comment has been minimized.

Copy link

bedevere-bot commented Jul 10, 2019

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
5 checks passed
5 checks passed
Azure Pipelines PR #20190710.22 succeeded
Details
bedevere/issue-number Issue number 37537 found
Details
bedevere/news News entry found in Misc/NEWS.d
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@bedevere-bot

This comment has been minimized.

Copy link

bedevere-bot commented Jul 10, 2019

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

@nascheme nascheme deleted the nascheme:obmalloc_no_allocated branch Jul 10, 2019
LorenzMende added a commit to LorenzMende/cpython that referenced this pull request Aug 11, 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.
lisroach added 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 added 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
Projects
None yet
5 participants
You can’t perform that action at this time.