You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Change PyMem_Malloc to use pymalloc allocator #70437
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2016-04-26.11:37:12.570>created_at=<Date2016-01-31.17:48:24.357>labels= ['performance']
title='Change PyMem_Malloc to use pymalloc allocator'updated_at=<Date2016-04-26.11:37:12.569>user='https://github.com/vstinner'
Test with jemalloc using the shell script "python.jemalloc":
---
#!/bin/sh
LD_PRELOAD=/usr/lib64/libjemalloc.so /home/haypo/prog/python/default/python "$@"
---
"perf.py -m" doesn't work with such bash script, but it works using exec:
---
#!/bin/sh
LD_PRELOAD=/usr/lib64/libjemalloc.so exec /home/haypo/prog/python/default/python "$@"
---
The following not significant results are hidden, use -v to show them:
chameleon_v2, json_load, nbody.
catalin-manciu commented on Feb 22, 2016
catalin-manciumannequin
Mannequin
More actions
Hi all,
Please find below the results from a complete GUPB run on a patched CPython 3.6. In average, an improvement of about 2.1% can be observed.
I'm also attaching an implementation of the patch for CPython 2.7 and its benchmark results. On GUPB the average performance boost is 1.5%.
In addition we are also seeing a 2.1% increase in throughput rate from our OpenStack Swift setup as measured by ssbench.
Compared to my proposition in issue bpo-26382, this patch yields slightly better results for CPython 3.6, gaining an average of +0.36% on GUPB,
and similar results for CPython 2.7.
Hardware and OS configuration:
==============================
Hardware: Intel XEON (Haswell-EP)
OS configuration: Address Space Layout Randomization (ASLR) disabled to reduce run
to run variation by echo 0 > /proc/sys/kernel/randomize_va_space
CPU frequency set fixed at 2.3GHz
Compared to my proposition in issue bpo-26382, this patch yields slightly better results for CPython 3.6, gaining an average of +0.36% on GUPB,
and similar results for CPython 2.7.
IMHO this change is too young to be backported to Python 2.7. I wrote it for Python 3.6 only. For Python 2.7, I suggest to write patches with narrow scope, as you did for the patch only modifying the list type.
I surprised to see slow-down, but I prefer to think that changes smaller than 5% are pure noise.
The good news is the long list of benchmarks with speedup larger than 5.0% :-) 22% on unpick list is nice to have too!
catalin-manciu commented on Feb 22, 2016
catalin-manciumannequin
Mannequin
More actions
I've just posted the results to an OpenStack Swift benchmark run using the patch from my proposition, issue bpo-26382.
Victor's patch, applied to CPython 2.7, adds an extra 1% compared to mine (which improved throughput by 1%), effectively doubling the performance gain. Swift is a highly complex real-world workload, so this result is quite significant.
I created the issue bpo-26516 "Add PYTHONMALLOC env var and add support for malloc debug hooks in release mode" to help developers to detect bugs in their code, especially misuse of the PyMem_Malloc() API.
Do you see any drawback of using pymalloc for PyMem_Malloc()?
Yes: You cannot free memory allocated using pymalloc with the
standard C lib free().
It would be better to go through the list of PyMem_() calls
in Python and replace them with PyObject_() calls, where
possible.
Does anyone recall the rationale to have two families to memory allocators?
The PyMem_*() APIs were needed to have a cross-platform malloc()
implementation which returns standard C lib free()able memory,
but also behaves well when passing 0 as size.
"""
M.-A. Lemburg fears that the PyMem_Malloc() API is misused:
"""
Sometimes, yes, but we also do allocations for e.g.
parsing values in Python argument tuples (e.g. using
"es" or "et"):
We do document to use PyMem_Free() on those; not sure whether
everyone does this though.
"""
M.-A. Lemburg suggested to the patch of this issue on:
"""
Yes, but those are part of the stdlib. You'd need to check
a few C extensions which are not tested as part of the stdlib,
e.g. numpy, scipy, lxml, pillow, etc. (esp. ones which implement custom
types in C since these will often need the memory management
APIs).
It may also be a good idea to check wrapper generators such
as cython, swig, cffi, etc.
"""
I'm talking about the performance improvement in third-party libraries, not the performance improvement in CPython itself which can be addressed by replacing the internal API calls.
I'm talking about the performance improvement in third-party libraries, not the performance improvement in CPython itself which can be addressed by replacing the internal API calls.
Oh ok. I don't know how to measure the performance of third-party libraries. I expect no speedup or a little speedup, but no slow-down.
Do you think it's reasonable to risk breaking external libraries just
for a hypothetic "performance improvement"?
The question is if my change really breaks anything in practice. I'm testing some popular C extensions to prepare an answer. Early results is that developer use correctly the Python allocator API :-)
I disagree on the fact that my change breaks any API. The API doc is clear. For example, you must use PyMem_Free() on memory allocated by PyMem_Malloc(). If you use free(), it fails badly with Python compiled in debug mode.
My issue bpo-26516 "Add PYTHONMALLOC env var and add support for malloc debug hooks in release mode" may help developers to validate their own application.
I suggest you to continue the discussion on python-dev for a wider audience. I will test a few more projects before replying on the python-dev thread.
I disagree on the fact that my change breaks any API. The API doc is
clear.
Does the API doc say anything about the GIL, for example? Or Valgrind?
I suggest you to continue the discussion on python-dev for a wider
audience. I will test a few more projects before replying on the
python-dev thread.
I have no interest in going back and forth between the Python tracker
and python-dev (especially since I hardly read python-dev these days).
If you address my questions positively here I will be happy with the patch!
"4 failed, 77064 passed, 3096 skipped in 405.09 seconds"
1 error is related to the version number (probably an issue on how I run the tests), 3 errors are FileNotFoundError related to cryptography_vectors. At least, there is no Python fatal error related to memory allocators ;-)
--
Hum, just in case, I checked my venv:
(ENV) haypo@smithers$ python -c 'import _testcapi; _testcapi.pymem_api_misuse()'
...
Fatal Python error: bad ID: Allocated using API 'o', verified using API 'r'
(ENV) haypo@smithers$ python -c 'import _testcapi; _testcapi.pymem_buffer_overflow()'
...
Fatal Python error: bad trailing pad byte
Red and bold warning: "The GIL must be held when using these functions."
Hum, sadly it looks like the warning miss in Python 2 doc.
The GIL was the motivation to introduce the PyMem_RawMalloc() function
in Python 3.4.
For Valgrind: using the issue bpo-26516, you will be able to use
PYTHONMALLOC=malloc to use easily Valgrind even on a Python compiled
in release mode (which is a new feature, before you had to manually
recompile Python in debug mode with --with-valgrind)).
Does the API doc say anything about the GIL, for example?
I modified Python to add assert(PyGILState_Check()); in PyMem_Malloc() and other functions.
Sadly, I found a bug in Numpy: Numpy releases the GIL for performance but call PyMem_Malloc() with the GIL released. I proposed a fix: numpy/numpy#7404
I guess that the fix is obvious and will be quickly merged, but it means that other libraries may have the issue.
Using the issue bpo-26516 (PYTHONMALLOC=debug), we can check PyGILState_Check() at runtime, but there is currently an issue related to sub-interpreters. The assertion fails in support.run_in_subinterp(), function used by test_threading and test_capi for example.
Using the issue bpo-26516 (PYTHONMALLOC=debug), we can check PyGILState_Check() at runtime, but there is currently an issue related to sub-interpreters. The assertion fails in support.run_in_subinterp(), function used by test_threading and test_capi for example.
I created bpo-26558 to implement GIL checks in PyMem_Malloc() and PyObject_Malloc().
I was very surprised to see a regression in test_format since I didn't change any change related to bytes, bytearray or str formatting in this issue.
In fact, it's much better than that! With PyMem_Malloc() using pymalloc, we benefit for free of the cheap "_Py_AllocatedBlocks" memory leak detector. I introduced the memory leak in the issue bpo-25349 when I optimimzed bytes%args and bytearray%args using the new _PyBytesWriter API.
This memory leak gave me an idea, I opened the issue bpo-26850: "PyMem_RawMalloc(): update also sys.getallocatedblocks() in debug mode".
Activity
vstinner commentedon Feb 2, 2016
To be honest, I didn't try to understand them :-) Are they the number of kB of the RSS memory?
Maybe perf.py doesn't like my shell script?
vstinner commentedon Feb 2, 2016
I have no idea.
vstinner commentedon Feb 2, 2016
"perf.py -m" doesn't work with such bash script, but it works using exec:
---
#!/bin/sh
LD_PRELOAD=/usr/lib64/libjemalloc.so exec /home/haypo/prog/python/default/python "$@"
---
Hum, it looks like jemalloc uses *more* memory than libc memory allocators. I don't know if it's a known
Report on Linux smithers 4.3.3-300.fc23.x86_64 #1 SMP Tue Jan 5 23:31:01 UTC 2016 x86_64 x86_64
Total CPU cores: 8
### 2to3 ###
Mem max: 43088.000 -> 43776.000: 1.0160x larger
### chameleon_v2 ###
Mem max: 367028.000 -> 626324.000: 1.7065x larger
### django_v3 ###
Mem max: 23824.000 -> 25120.000: 1.0544x larger
### fastpickle ###
Mem max: 8696.000 -> 9712.000: 1.1168x larger
### fastunpickle ###
Mem max: 8708.000 -> 9696.000: 1.1135x larger
### json_dump_v2 ###
Mem max: 10488.000 -> 11556.000: 1.1018x larger
### json_load ###
Mem max: 8444.000 -> 9396.000: 1.1127x larger
### nbody ###
Mem max: 7392.000 -> 8416.000: 1.1385x larger
### regex_v8 ###
Mem max: 12760.000 -> 13576.000: 1.0639x larger
### tornado_http ###
Mem max: 28196.000 -> 29920.000: 1.0611x larger
vstinner commentedon Feb 2, 2016
(Crap. I sent an incomplete message, sorry about that.)
I don't know if it's a known issue/property of jemalloc.
vstinner commentedon Feb 2, 2016
Yury: "Please use -r flag for perf.py"
Oh, I didn't know this flag. Sure, I can do that.
New benchmark using --rigorous to measure the performance of attached pymem.patch.
It always seems faster, newer slower.
Report on Linux smithers 4.3.3-300.fc23.x86_64 #1 SMP Tue Jan 5 23:31:01 UTC 2016 x86_64 x86_64
Total CPU cores: 8
### 2to3 ###
Min: 6.772531 -> 6.686245: 1.01x faster
Avg: 6.875264 -> 6.726859: 1.02x faster
Significant (t=3.44)
Stddev: 0.09026 -> 0.03398: 2.6560x smaller
### django_v3 ###
Min: 0.562797 -> 0.552539: 1.02x faster
Avg: 0.591345 -> 0.557561: 1.06x faster
Significant (t=4.17)
Stddev: 0.07689 -> 0.02581: 2.9794x smaller
### fastpickle ###
Min: 0.464270 -> 0.437667: 1.06x faster
Avg: 0.467195 -> 0.442298: 1.06x faster
Significant (t=10.59)
Stddev: 0.01156 -> 0.02046: 1.7693x larger
### fastunpickle ###
Min: 0.548834 -> 0.526554: 1.04x faster
Avg: 0.554601 -> 0.539456: 1.03x faster
Significant (t=4.67)
Stddev: 0.01137 -> 0.03040: 2.6734x larger
### json_dump_v2 ###
Min: 2.723152 -> 2.603108: 1.05x faster
Avg: 2.749255 -> 2.693655: 1.02x faster
Significant (t=2.89)
Stddev: 0.03016 -> 0.18988: 6.2963x larger
### regex_v8 ###
Min: 0.044256 -> 0.042201: 1.05x faster
Avg: 0.044733 -> 0.043134: 1.04x faster
Significant (t=4.55)
Stddev: 0.00201 -> 0.00288: 1.4309x larger
### tornado_http ###
Min: 0.253405 -> 0.247401: 1.02x faster
Avg: 0.256274 -> 0.250380: 1.02x faster
Significant (t=17.48)
Stddev: 0.00285 -> 0.00382: 1.3430x larger
The following not significant results are hidden, use -v to show them:
chameleon_v2, json_load, nbody.
catalin-manciu commentedon Feb 22, 2016
Hi all,
Please find below the results from a complete GUPB run on a patched CPython 3.6. In average, an improvement of about 2.1% can be observed.
I'm also attaching an implementation of the patch for CPython 2.7 and its benchmark results. On GUPB the average performance boost is 1.5%.
In addition we are also seeing a 2.1% increase in throughput rate from our OpenStack Swift setup as measured by ssbench.
Compared to my proposition in issue bpo-26382, this patch yields slightly better results for CPython 3.6, gaining an average of +0.36% on GUPB,
and similar results for CPython 2.7.
Hardware and OS configuration:
==============================
Hardware: Intel XEON (Haswell-EP)
BIOS settings: Intel Turbo Boost Technology: false
Hyper-Threading: false
OS: Ubuntu 14.04.2 LTS
OS configuration: Address Space Layout Randomization (ASLR) disabled to reduce run
to run variation by echo 0 > /proc/sys/kernel/randomize_va_space
CPU frequency set fixed at 2.3GHz
Repository info:
================
CPython2 : 2d8e8d0e7162 (2.7)
CPython3 : f9391e2b74a5 tip
Results
=======
Table 1: CPython 3 GUPB results
-------------------------------
unpickle_list 22.74%
mako_v2 9.13%
nqueens 6.32%
meteor_contest 5.61%
fannkuch 5.34%
simple_logging 5.28%
formatted_logging 5.06%
fastunpickle 4.37%
json_dump_v2 3.10%
regex_compile 3.01%
raytrace 2.95%
pathlib 2.43%
tornado_http 2.22%
django_v3 1.94%
telco 1.65%
pickle_list 1.59%
chaos 1.50%
etree_process 1.48%
fastpickle 1.34%
silent_logging 1.12%
2to3 1.09%
float 1.01%
nbody 0.89%
normal_startup 0.86%
startup_nosite 0.79%
richards 0.67%
regex_v8 0.61%
etree_generate 0.57%
hexiom2 0.54%
pickle_dict 0.20%
call_simple 0.18%
spectral_norm 0.17%
regex_effbot 0.16%
unpack_sequence 0.00%
call_method_unknown -0.04%
chameleon_v2 -0.07%
json_load -0.08%
etree_parse -0.09%
pidigits -0.15%
go -0.16%
etree_iterparse -0.22%
call_method_slots -0.49%
call_method -0.97%
Table 2: CPython 2 GUPB results
-------------------------------
unpickle_list 16.88%
json_load 11.74%
fannkuch 8.11%
mako_v2 6.91%
meteor_contest 6.27%
slowpickle 4.81%
nqueens 4.46%
html5lib_warmup 3.53%
chaos 2.67%
regex_v8 2.56%
html5lib 2.34%
fastunpickle 2.32%
tornado_http 2.23%
rietveld 2.15%
simple_logging 1.82%
normal_startup 1.57%
call_method_slots 1.53%
telco 1.49%
regex_compile 1.47%
spectral_norm 1.36%
hg_startup 1.27%
regex_effbot 1.18%
nbody 1.02%
2to3 1.01%
pybench 0.99%
chameleon_v2 0.98%
slowunpickle 0.93%
startup_nosite 0.92%
pickle_list 0.89%
richards 0.56%
django_v3 0.48%
json_dump_v2 0.41%
raytrace 0.38%
unpack_sequence 0.00%
float -0.05%
slowspitfire -0.07%
go -0.24%
hexiom2 -0.26%
spambayes -0.27%
pickle_dict -0.30%
etree_parse -0.32%
pidigits -0.41%
etree_iterparse -0.47%
bzr_startup -0.55%
fastpickle -0.74%
etree_process -0.96%
formatted_logging -1.01%
call_simple -1.08%
pathlib -1.12%
silent_logging -1.22%
etree_generate -1.23%
call_method_unknown -2.14%
call_method -2.22%
Table 3: OpenStack Swift ssbench results
----------------------------------------
ssbench 2.11%
vstinner commentedon Feb 22, 2016
IMHO this change is too young to be backported to Python 2.7. I wrote it for Python 3.6 only. For Python 2.7, I suggest to write patches with narrow scope, as you did for the patch only modifying the list type.
"""
Table 1: CPython 3 GUPB results
-------------------------------
unpickle_list 22.74%
mako_v2 9.13%
nqueens 6.32%
meteor_contest 5.61%
fannkuch 5.34%
simple_logging 5.28%
formatted_logging 5.06%
"""
I surprised to see slow-down, but I prefer to think that changes smaller than 5% are pure noise.
The good news is the long list of benchmarks with speedup larger than 5.0% :-) 22% on unpick list is nice to have too!
catalin-manciu commentedon Feb 22, 2016
I've just posted the results to an OpenStack Swift benchmark run using the patch from my proposition, issue bpo-26382.
Victor's patch, applied to CPython 2.7, adds an extra 1% compared to mine (which improved throughput by 1%), effectively doubling the performance gain. Swift is a highly complex real-world workload, so this result is quite significant.
[-]Change PyMem_Malloc to use PyObject_Malloc allocator?[/-][+]Change PyMem_Malloc to use pymalloc allocator[/+]vstinner commentedon Mar 9, 2016
I created the issue bpo-26516 "Add PYTHONMALLOC env var and add support for malloc debug hooks in release mode" to help developers to detect bugs in their code, especially misuse of the PyMem_Malloc() API.
vstinner commentedon Mar 9, 2016
Patch 3:
vstinner commentedon Mar 9, 2016
In february 2016, I started a thread on the python-dev mailing list:
[Python-Dev] Modify PyMem_Malloc to use pymalloc for performance
https://mail.python.org/pipermail/python-dev/2016-February/143084.html
M.-A. Lemburg wrote:
"""
Yes: You cannot free memory allocated using pymalloc with the
standard C lib free().
It would be better to go through the list of PyMem_() calls
in Python and replace them with PyObject_() calls, where
possible.
The PyMem_*() APIs were needed to have a cross-platform malloc()
implementation which returns standard C lib free()able memory,
but also behaves well when passing 0 as size.
"""
M.-A. Lemburg fears that the PyMem_Malloc() API is misused:
"""
Sometimes, yes, but we also do allocations for e.g.
parsing values in Python argument tuples (e.g. using
"es" or "et"):
https://docs.python.org/3.6/c-api/arg.html
We do document to use PyMem_Free() on those; not sure whether
everyone does this though.
"""
M.-A. Lemburg suggested to the patch of this issue on:
"""
Yes, but those are part of the stdlib. You'd need to check
a few C extensions which are not tested as part of the stdlib,
e.g. numpy, scipy, lxml, pillow, etc. (esp. ones which implement custom
types in C since these will often need the memory management
APIs).
It may also be a good idea to check wrapper generators such
as cython, swig, cffi, etc.
"""
vstinner commentedon Mar 9, 2016
numpy: good!
Commands ran in numpy tests in a virtual environment:
numpy$ python setup.py install
numpy$ cd..
$ python -c 'import numpy; numpy.test()'
(...)
Ran 6206 tests in 280.986s
OK (KNOWNFAIL=7, SKIP=6)
pitrou commentedon Mar 9, 2016
Victor, why do you insist on this instead of changing internal API calls in CPython?
vstinner commentedon Mar 9, 2016
Antoine Pitrou added the comment:
https://mail.python.org/pipermail/python-dev/2016-February/143097.html
"There are 536 calls to the functions PyMem_Malloc(), PyMem_Realloc()
and PyMem_Free()."
pitrou commentedon Mar 9, 2016
I'm sure you can use powerful tools such as "sed" ;-)
vstinner commentedon Mar 9, 2016
I guess that PyMem functions are used in third party C extensions modules. I expect (minor) speedup in these modules too.
I don't understand why we should keep a slow allocator if Python has a faster allocator?
vstinner commentedon Mar 9, 2016
lxml: good!
lxml$ make test
(...)
Ran 1735 tests in 27.663s
OK
vstinner commentedon Mar 9, 2016
Pillow: good
Note: I had to install JPEG headers (sudo dnf install -y libjpeg-turbo-devel).
Tested version: git commit 555544c5cfc3874deaac9cfa87780822ee714c0d (Mar 8 2016).
---
Pillow$ python setup.py install
Pillow$ python selftest.py
Pillow$ python test-installed.py
(...)
Ran 671 tests in 8.458s
FAILED (SKIP=124, errors=2)
---
The two errors are "OSError: decoder libtiff not available".
pitrou commentedon Mar 9, 2016
Le 09/03/2016 18:01, STINNER Victor a écrit :
Define "slow". malloc() on Linux should be reasonably fast.
Do you think it's reasonable to risk breaking external libraries just
for a hypothetic "performance improvement"?
Again, why don't you try simply changing internal calls?
vstinner commentedon Mar 9, 2016
See first messages of this issue for benchmark results. Some specific benchmarks are faster, none is slower.
Yes. It was discussed in the python-dev thread.
pitrou commentedon Mar 9, 2016
I'm talking about the performance improvement in third-party libraries, not the performance improvement in CPython itself which can be addressed by replacing the internal API calls.
vstinner commentedon Mar 9, 2016
Oh ok. I don't know how to measure the performance of third-party libraries. I expect no speedup or a little speedup, but no slow-down.
The question is if my change really breaks anything in practice. I'm testing some popular C extensions to prepare an answer. Early results is that developer use correctly the Python allocator API :-)
I disagree on the fact that my change breaks any API. The API doc is clear. For example, you must use PyMem_Free() on memory allocated by PyMem_Malloc(). If you use free(), it fails badly with Python compiled in debug mode.
My issue bpo-26516 "Add PYTHONMALLOC env var and add support for malloc debug hooks in release mode" may help developers to validate their own application.
I suggest you to continue the discussion on python-dev for a wider audience. I will test a few more projects before replying on the python-dev thread.
pitrou commentedon Mar 9, 2016
Le 09/03/2016 18:27, STINNER Victor a écrit :
Does the API doc say anything about the GIL, for example? Or Valgrind?
I have no interest in going back and forth between the Python tracker
and python-dev (especially since I hardly read python-dev these days).
If you address my questions positively here I will be happy with the patch!
vstinner commentedon Mar 9, 2016
cryptography: good
"4 failed, 77064 passed, 3096 skipped in 405.09 seconds"
1 error is related to the version number (probably an issue on how I run the tests), 3 errors are FileNotFoundError related to cryptography_vectors. At least, there is no Python fatal error related to memory allocators ;-)
--
Hum, just in case, I checked my venv:
(ENV) haypo@smithers$ python -c 'import _testcapi; _testcapi.pymem_api_misuse()'
...
Fatal Python error: bad ID: Allocated using API 'o', verified using API 'r'
(ENV) haypo@smithers$ python -c 'import _testcapi; _testcapi.pymem_buffer_overflow()'
...
Fatal Python error: bad trailing pad byte
It works ;-)
vstinner commentedon Mar 9, 2016
2016-03-09 18:28 GMT+01:00 Antoine Pitrou <report@bugs.python.org>:
For the GIL, yes, Python 3 doc is explicit:
https://docs.python.org/dev/c-api/memory.html#memory-interface
Red and bold warning: "The GIL must be held when using these functions."
Hum, sadly it looks like the warning miss in Python 2 doc.
The GIL was the motivation to introduce the PyMem_RawMalloc() function
in Python 3.4.
For Valgrind: using the issue bpo-26516, you will be able to use
PYTHONMALLOC=malloc to use easily Valgrind even on a Python compiled
in release mode (which is a new feature, before you had to manually
recompile Python in debug mode with --with-valgrind)).
vstinner commentedon Mar 10, 2016
I modified Python to add assert(PyGILState_Check()); in PyMem_Malloc() and other functions.
Sadly, I found a bug in Numpy: Numpy releases the GIL for performance but call PyMem_Malloc() with the GIL released. I proposed a fix:
numpy/numpy#7404
I guess that the fix is obvious and will be quickly merged, but it means that other libraries may have the issue.
Using the issue bpo-26516 (PYTHONMALLOC=debug), we can check PyGILState_Check() at runtime, but there is currently an issue related to sub-interpreters. The assertion fails in support.run_in_subinterp(), function used by test_threading and test_capi for example.
vstinner commentedon Mar 14, 2016
pymalloc.patch: Updated patch.
vstinner commentedon Mar 14, 2016
I created bpo-26558 to implement GIL checks in PyMem_Malloc() and PyObject_Malloc().
vstinner commentedon Mar 14, 2016
I created the issue bpo-26563 "PyMem_Malloc(): check that the GIL is hold in debug hooks".
python-dev commentedon Apr 22, 2016
New changeset 68b2a43d8653 by Victor Stinner in branch 'default':
PyMem_Malloc() now uses the fast pymalloc allocator
https://hg.python.org/cpython/rev/68b2a43d8653
python-dev commentedon Apr 22, 2016
New changeset 104ed24ebbd0 by Victor Stinner in branch 'default':
Issue bpo-26249: Try test_capi on Windows
https://hg.python.org/cpython/rev/104ed24ebbd0
python-dev commentedon Apr 24, 2016
New changeset 7acad5d8f80e by Victor Stinner in branch 'default':
Issue bpo-26249: Mention PyMem_Malloc() change in What's New in Python 3.6 in the
https://hg.python.org/cpython/rev/7acad5d8f80e
vstinner commentedon Apr 24, 2016
I documented the change, buildbots are happy, I close the issue.
serhiy-storchaka commentedon Apr 25, 2016
68b2a43d8653 introduced memory leak.
python-dev commentedon Apr 26, 2016
New changeset 090502a0c69c by Victor Stinner in branch 'default':
Issue bpo-25349, bpo-26249: Fix memleak in formatfloat()
https://hg.python.org/cpython/rev/090502a0c69c
vstinner commentedon Apr 26, 2016
I was very surprised to see a regression in test_format since I didn't change any change related to bytes, bytearray or str formatting in this issue.
In fact, it's much better than that! With PyMem_Malloc() using pymalloc, we benefit for free of the cheap "_Py_AllocatedBlocks" memory leak detector. I introduced the memory leak in the issue bpo-25349 when I optimimzed bytes%args and bytearray%args using the new _PyBytesWriter API.
This memory leak gave me an idea, I opened the issue bpo-26850: "PyMem_RawMalloc(): update also sys.getallocatedblocks() in debug mode".
vstinner commentedon Apr 26, 2016
There are no more know bugs related to this change, I close the issue. Thanks for the test_format report Serhiy, I missed it.