@@ -12,6 +12,19 @@ Misc/valgrind-python.supp. Second, you must do one of the following:
1212 * Uncomment the lines in Misc/valgrind-python.supp that
1313 suppress the warnings for PyObject_Free and PyObject_Realloc
1414
15+ If you want to use Valgrind more effectively and catch even more
16+ memory leaks, you will need to configure python --without-pymalloc.
17+ PyMalloc allocates a few blocks in big chunks and most object
18+ allocations don't call malloc, they use chunks doled about by PyMalloc
19+ from the big blocks. This means Valgrind can't detect
20+ many allocations (and frees), except for those that are forwarded
21+ to the system malloc. Note: configuring python --without-pymalloc
22+ makes Python run much slower, especially when running under Valgrind.
23+ You may need to run the tests in batches under Valgrind to keep
24+ the memory usage down to allow the tests to complete. It seems to take
25+ about 5 times longer to run --without-pymalloc.
26+
27+
1528Details:
1629--------
1730Python uses its own small-object allocation scheme on top of malloc,
@@ -21,7 +34,8 @@ Valgrind may show some unexpected results when PyMalloc is used.
2134Starting with Python 2.3, PyMalloc is used by default. You can disable
2235PyMalloc when configuring python by adding the --without-pymalloc option.
2336If you disable PyMalloc, most of the information in this document and
24- the supplied suppressions file will not be useful.
37+ the supplied suppressions file will not be useful. As discussed above,
38+ disabling PyMalloc can catch more problems.
2539
2640If you use valgrind on a default build of Python, you will see
2741many errors like:
0 commit comments