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-32030: Rework memory allocators #4625

Merged
merged 3 commits into from Nov 29, 2017
Merged

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Nov 29, 2017

  • Fix _PyMem_SetupAllocators("debug"): always restore allocators to
    the defaults, rather than only caling _PyMem_SetupDebugHooks().
  • Add _PyMem_SetDefaultAllocator() helper to set the "default"
    allocator.
  • main() now uses debug hooks on memory allocators if Py_DEBUG is
    defined, rather than calling directly malloc()

https://bugs.python.org/issue32030

* Fix _PyMem_SetupAllocators("debug"): always restore allocators to
  the defaults, rather than only caling _PyMem_SetupDebugHooks().
* Add _PyMem_SetDefaultAllocator() helper to set the "default"
  allocator.
* Add _PyMem_GetAllocatorsName(): get the name of the allocators
* main() now uses debug hooks on memory allocators if Py_DEBUG is
  defined, rather than calling directly malloc()
* Document default memory allocators in C API documentation
* _Py_InitializeCore() now fails with a fatal user error if
  PYTHONMALLOC value is an unknown memory allocator, instead of
  failing with a fatal internal error.
* Add new tests on the PYTHONMALLOC environment variable
@vstinner vstinner changed the title bpo-32030: Fix _PyMem_SetupDebugHooks() bpo-32030: Rework memory allocators Nov 29, 2017
@vstinner
Copy link
Member Author

vstinner commented Nov 29, 2017

I tested manually the PR. I ran "test_sys test_cmd_line test_capi" tests in these configurations:

  • release, no pymalloc: "malloc": OK
  • release, pymalloc: "pymalloc": OK
  • pydebug, no pymalloc: "malloc_debug": OK
  • pydebug, pymalloc: "pymalloc_debug": OK

vstinner added 2 commits Nov 29, 2017
Add the _testcapi.WITH_PYMALLOC constant and expose it as
support.with_pymalloc().

sysconfig.get_config_var('WITH_PYMALLOC') doesn't work on Windows, so
replace it with support.with_pymalloc().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants