Back to index

php5  5.3.10
Functions
mysqlnd_block_alloc.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

PHPAPI MYSQLND_MEMORY_POOL * mysqlnd_mempool_create (size_t arena_size TSRMLS_DC)
PHPAPI void mysqlnd_mempool_destroy (MYSQLND_MEMORY_POOL *pool TSRMLS_DC)

Function Documentation

PHPAPI MYSQLND_MEMORY_POOL* mysqlnd_mempool_create ( size_t arena_size  TSRMLS_DC)

Definition at line 153 of file mysqlnd_block_alloc.c.

{
       /* We calloc, because we free(). We don't mnd_calloc()  for a reason. */
       MYSQLND_MEMORY_POOL * ret = mnd_calloc(1, sizeof(MYSQLND_MEMORY_POOL));
       DBG_ENTER("mysqlnd_mempool_create");
       if (ret) {
              ret->get_chunk = mysqlnd_mempool_get_chunk;
              ret->free_size = ret->arena_size = arena_size ? arena_size : 0;
              ret->refcount = 0;
              /* OOM ? */
              ret->arena = mnd_malloc(ret->arena_size);
              if (!ret->arena) {
                     mysqlnd_mempool_destroy(ret TSRMLS_CC);
                     ret = NULL;
              }
       }
       DBG_RETURN(ret);
}

Here is the call graph for this function:

Here is the caller graph for this function:

PHPAPI void mysqlnd_mempool_destroy ( MYSQLND_MEMORY_POOL *pool  TSRMLS_DC)

Definition at line 176 of file mysqlnd_block_alloc.c.

{
       DBG_ENTER("mysqlnd_mempool_destroy");
       /* mnd_free will reference LOCK_access and might crash, depending on the caller...*/
       mnd_free(pool->arena);
       mnd_free(pool);
       DBG_VOID_RETURN;
}

Here is the call graph for this function:

Here is the caller graph for this function: