Skip to content

Conversation

@nascheme
Copy link
Member

@nascheme 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.
Copy link
Member

@tim-one tim-one left a comment

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

@bedevere-bot
Copy link

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

@nascheme
Copy link
Member Author

I have made the requested changes; please review again

@bedevere-bot
Copy link

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

@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