From 892dbb41bc633cdeded2446eabe6c72adbd44bd2 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 12 May 2020 02:22:00 +0200 Subject: [PATCH] bpo-40602: _Py_hashtable_new() uses PyMem_Malloc() _Py_hashtable_new() now uses PyMem_Malloc/PyMem_Free allocator by default, rather than PyMem_RawMalloc/PyMem_RawFree. PyMem_Malloc is faster than PyMem_RawMalloc for memory blocks smaller than or equal to 512 bytes. --- Python/hashtable.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Python/hashtable.c b/Python/hashtable.c index 22b84590105f9e..e9f02d8650e4f8 100644 --- a/Python/hashtable.c +++ b/Python/hashtable.c @@ -149,11 +149,12 @@ _Py_hashtable_new_full(size_t key_size, size_t data_size, _Py_hashtable_allocator_t alloc; if (allocator == NULL) { - alloc.malloc = PyMem_RawMalloc; - alloc.free = PyMem_RawFree; + alloc.malloc = PyMem_Malloc; + alloc.free = PyMem_Free; } - else + else { alloc = *allocator; + } ht = (_Py_hashtable_t *)alloc.malloc(sizeof(_Py_hashtable_t)); if (ht == NULL) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy