Skip to content

Commit 85b6b70

Browse files
naschemetim-one
andauthored
bpo-37448: Use radix tree for pymalloc address_in_range(). (GH-14474)
The radix tree approach is a relatively simple and memory sanitary alternative to the old (slightly) unsanitary address_in_range(). To disable the radix tree map, set a preprocessor flag as follows: -DWITH_PYMALLOC_RADIX_TREE=0. Co-authored-by: Tim Peters <[email protected]>
1 parent a54fc68 commit 85b6b70

File tree

2 files changed

+351
-5
lines changed

2 files changed

+351
-5
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Add a radix tree based memory map to track in-use obmalloc arenas. Use to
2+
replace the old implementation of address_in_range(). The radix tree
3+
approach makes it easy to increase pool sizes beyond the OS page size.
4+
Boosting the pool and arena size allows obmalloc to handle a significantly
5+
higher percentage of requests from its ultra-fast paths.
6+
7+
It also has the advantage of eliminating the memory unsanitary behavior of
8+
the previous address_in_range(). The old address_in_range() was marked with
9+
the annotations _Py_NO_SANITIZE_ADDRESS, _Py_NO_SANITIZE_THREAD, and
10+
_Py_NO_SANITIZE_MEMORY. Those annotations are no longer needed.
11+
12+
To disable the radix tree map, set a preprocessor flag as follows:
13+
`-DWITH_PYMALLOC_RADIX_TREE=0`.
14+
15+
Co-authored-by: Tim Peters <[email protected]>

0 commit comments

Comments
 (0)