Lines Matching refs:arena
130 PyArena* arena = (PyArena *)PyMem_Malloc(sizeof(PyArena)); in PyArena_New() local
131 if (!arena) in PyArena_New()
134 arena->a_head = block_new(DEFAULT_BLOCK_SIZE); in PyArena_New()
135 arena->a_cur = arena->a_head; in PyArena_New()
136 if (!arena->a_head) { in PyArena_New()
137 PyMem_Free((void *)arena); in PyArena_New()
140 arena->a_objects = PyList_New(0); in PyArena_New()
141 if (!arena->a_objects) { in PyArena_New()
142 block_free(arena->a_head); in PyArena_New()
143 PyMem_Free((void *)arena); in PyArena_New()
147 arena->total_allocs = 0; in PyArena_New()
148 arena->total_size = 0; in PyArena_New()
149 arena->total_blocks = 1; in PyArena_New()
150 arena->total_block_size = DEFAULT_BLOCK_SIZE; in PyArena_New()
151 arena->total_big_blocks = 0; in PyArena_New()
153 return arena; in PyArena_New()
157 PyArena_Free(PyArena *arena) in PyArena_Free() argument
159 assert(arena); in PyArena_Free()
169 block_free(arena->a_head); in PyArena_Free()
175 Py_DECREF(arena->a_objects); in PyArena_Free()
176 PyMem_Free(arena); in PyArena_Free()
180 PyArena_Malloc(PyArena *arena, size_t size) in PyArena_Malloc() argument
182 void *p = block_alloc(arena->a_cur, size); in PyArena_Malloc()
186 arena->total_allocs++; in PyArena_Malloc()
187 arena->total_size += size; in PyArena_Malloc()
190 if (arena->a_cur->ab_next) { in PyArena_Malloc()
191 arena->a_cur = arena->a_cur->ab_next; in PyArena_Malloc()
193 arena->total_blocks++; in PyArena_Malloc()
194 arena->total_block_size += arena->a_cur->ab_size; in PyArena_Malloc()
195 if (arena->a_cur->ab_size > DEFAULT_BLOCK_SIZE) in PyArena_Malloc()
196 ++arena->total_big_blocks; in PyArena_Malloc()
203 PyArena_AddPyObject(PyArena *arena, PyObject *obj) in PyArena_AddPyObject() argument
205 int r = PyList_Append(arena->a_objects, obj); in PyArena_AddPyObject()