Lines Matching refs:chunk
29 mysqlnd_mempool_free_chunk(MYSQLND_MEMORY_POOL * pool, MYSQLND_MEMORY_POOL_CHUNK * chunk) in mysqlnd_mempool_free_chunk() argument
32 if (chunk->from_pool) { in mysqlnd_mempool_free_chunk()
34 if (chunk->ptr == (pool->arena + (pool->arena_size - pool->free_size - chunk->size))) { in mysqlnd_mempool_free_chunk()
39 pool->free_size += chunk->size; in mysqlnd_mempool_free_chunk()
42 mnd_efree(chunk->ptr); in mysqlnd_mempool_free_chunk()
44 mnd_efree(chunk); in mysqlnd_mempool_free_chunk()
52 mysqlnd_mempool_resize_chunk(MYSQLND_MEMORY_POOL * pool, MYSQLND_MEMORY_POOL_CHUNK * chunk, unsigne… in mysqlnd_mempool_resize_chunk() argument
55 if (chunk->from_pool) { in mysqlnd_mempool_resize_chunk()
57 if (chunk->ptr == (pool->arena + (pool->arena_size - pool->free_size - chunk->size))) { in mysqlnd_mempool_resize_chunk()
62 if ((chunk->size + pool->free_size) < size) { in mysqlnd_mempool_resize_chunk()
68 memcpy(new_ptr, chunk->ptr, chunk->size); in mysqlnd_mempool_resize_chunk()
69 chunk->ptr = new_ptr; in mysqlnd_mempool_resize_chunk()
70 pool->free_size += chunk->size; in mysqlnd_mempool_resize_chunk()
71 chunk->size = size; in mysqlnd_mempool_resize_chunk()
72 chunk->from_pool = FALSE; /* now we have no pool memory */ in mysqlnd_mempool_resize_chunk()
75 pool->free_size += (chunk->size - size); in mysqlnd_mempool_resize_chunk()
79 if (chunk->size >= size) { in mysqlnd_mempool_resize_chunk()
87 memcpy(new_ptr, chunk->ptr, chunk->size); in mysqlnd_mempool_resize_chunk()
88 chunk->ptr = new_ptr; in mysqlnd_mempool_resize_chunk()
89 chunk->size = size; in mysqlnd_mempool_resize_chunk()
90 chunk->from_pool = FALSE; /* now we have non-pool memory */ in mysqlnd_mempool_resize_chunk()
94 zend_uchar *new_ptr = mnd_erealloc(chunk->ptr, size); in mysqlnd_mempool_resize_chunk()
98 chunk->ptr = new_ptr; in mysqlnd_mempool_resize_chunk()
109 MYSQLND_MEMORY_POOL_CHUNK *chunk = NULL; in mysqlnd_mempool_get_chunk() local
112 chunk = mnd_emalloc(sizeof(MYSQLND_MEMORY_POOL_CHUNK)); in mysqlnd_mempool_get_chunk()
113 if (chunk) { in mysqlnd_mempool_get_chunk()
114 chunk->size = size; in mysqlnd_mempool_get_chunk()
121 chunk->from_pool = FALSE; in mysqlnd_mempool_get_chunk()
122 chunk->ptr = mnd_emalloc(size); in mysqlnd_mempool_get_chunk()
123 if (!chunk->ptr) { in mysqlnd_mempool_get_chunk()
124 pool->free_chunk(pool, chunk); in mysqlnd_mempool_get_chunk()
125 chunk = NULL; in mysqlnd_mempool_get_chunk()
128 chunk->from_pool = TRUE; in mysqlnd_mempool_get_chunk()
129 chunk->ptr = pool->arena + (pool->arena_size - pool->free_size); in mysqlnd_mempool_get_chunk()
134 DBG_RETURN(chunk); in mysqlnd_mempool_get_chunk()