Lines Matching refs:arena
133 PyArena* arena = (PyArena *)malloc(sizeof(PyArena)); in PyArena_New() local
134 if (!arena) in PyArena_New()
137 arena->a_head = block_new(DEFAULT_BLOCK_SIZE); in PyArena_New()
138 arena->a_cur = arena->a_head; in PyArena_New()
139 if (!arena->a_head) { in PyArena_New()
140 free((void *)arena); in PyArena_New()
143 arena->a_objects = PyList_New(0); in PyArena_New()
144 if (!arena->a_objects) { in PyArena_New()
145 block_free(arena->a_head); in PyArena_New()
146 free((void *)arena); in PyArena_New()
150 arena->total_allocs = 0; in PyArena_New()
151 arena->total_size = 0; in PyArena_New()
152 arena->total_blocks = 1; in PyArena_New()
153 arena->total_block_size = DEFAULT_BLOCK_SIZE; in PyArena_New()
154 arena->total_big_blocks = 0; in PyArena_New()
156 return arena; in PyArena_New()
160 PyArena_Free(PyArena *arena) in PyArena_Free() argument
162 assert(arena); in PyArena_Free()
172 block_free(arena->a_head); in PyArena_Free()
178 Py_DECREF(arena->a_objects); in PyArena_Free()
179 free(arena); in PyArena_Free()
183 PyArena_Malloc(PyArena *arena, size_t size) in PyArena_Malloc() argument
185 void *p = block_alloc(arena->a_cur, size); in PyArena_Malloc()
189 arena->total_allocs++; in PyArena_Malloc()
190 arena->total_size += size; in PyArena_Malloc()
193 if (arena->a_cur->ab_next) { in PyArena_Malloc()
194 arena->a_cur = arena->a_cur->ab_next; in PyArena_Malloc()
196 arena->total_blocks++; in PyArena_Malloc()
197 arena->total_block_size += arena->a_cur->ab_size; in PyArena_Malloc()
198 if (arena->a_cur->ab_size > DEFAULT_BLOCK_SIZE) in PyArena_Malloc()
199 ++arena->total_big_blocks; in PyArena_Malloc()
206 PyArena_AddPyObject(PyArena *arena, PyObject *obj) in PyArena_AddPyObject() argument
208 int r = PyList_Append(arena->a_objects, obj); in PyArena_AddPyObject()