File tree 2 files changed +3
-21
lines changed
2 files changed +3
-21
lines changed Original file line number Diff line number Diff line change
1
+ Remove freelist from collections.deque().
Original file line number Diff line number Diff line change @@ -117,23 +117,9 @@ static PyTypeObject deque_type;
117
117
#define CHECK_NOT_END (link )
118
118
#endif
119
119
120
- /* A simple freelisting scheme is used to minimize calls to the memory
121
- allocator. It accommodates common use cases where new blocks are being
122
- added at about the same rate as old blocks are being freed.
123
- */
124
-
125
- #define MAXFREEBLOCKS 16
126
- static Py_ssize_t numfreeblocks = 0 ;
127
- static block * freeblocks [MAXFREEBLOCKS ];
128
-
129
120
static block *
130
121
newblock (void ) {
131
- block * b ;
132
- if (numfreeblocks ) {
133
- numfreeblocks -- ;
134
- return freeblocks [numfreeblocks ];
135
- }
136
- b = PyMem_Malloc (sizeof (block ));
122
+ block * b = PyMem_Malloc (sizeof (block ));
137
123
if (b != NULL ) {
138
124
return b ;
139
125
}
@@ -144,12 +130,7 @@ newblock(void) {
144
130
static void
145
131
freeblock (block * b )
146
132
{
147
- if (numfreeblocks < MAXFREEBLOCKS ) {
148
- freeblocks [numfreeblocks ] = b ;
149
- numfreeblocks ++ ;
150
- } else {
151
- PyMem_Free (b );
152
- }
133
+ PyMem_Free (b );
153
134
}
154
135
155
136
static PyObject *
You can’t perform that action at this time.
0 commit comments