Back to Mimalloc

mi

docs/group__constantsize.html

3.5.03.6 KB
Original Source

| | mi-malloc 3.4/2.4/1.9 | |

Loading...

Searching...

No Matches

Functions

Constant size allocation

Constant size allocation and freeing For example: More...

|

Functions

| | void * | mi_malloc_csize (size_t size) | | | Allocate a constant size object.
| | | | void * | mi_zalloc_csize (size_t size) | | | | void * | mi_theap_malloc_csize (mi_theap_t *theap, size_t size) | | | | void * | mi_theap_zalloc_csize (mi_theap_t *theap, size_t size) | | | | void | mi_free_csize (void *p, size_t size) | | | Free a pointer with a known constant size.
| | |

Detailed Description

Constant size allocation and freeing For example:

long* p = (long*)mi_malloc_csize(sizeof(long))

mi_malloc_csize

void * mi_malloc_csize(size_t size)

Allocate a constant size object.

On v3 these can improve performance as they will statically use mi_malloc_small(), mi_free_small(), etc. when possible. This is especially useful for compilers and runtimes where the the size is often statically known. These functions can be used even when the size is not constant but then there is no performance benefit.

Function Documentation

mi_free_csize()

| void mi_free_csize | ( | void * | p, | | | | size_t | size ) |

Free a pointer with a known constant size.

Parameters

| p | The pointer to the allocated block (or NULL ) | | size | The (compile time constant) size with which the pointer was allocated. |

See alsomi_malloc_csize() mi_free_size()

mi_malloc_csize()

| void * mi_malloc_csize | ( | size_t | size | ) | |

Allocate a constant size object.

Parameters

| size | A (compile-time) constant size. |

ReturnsA pointer to an allocated block of size size bytes. See alsomi_free_csize() mi_malloc()

mi_theap_malloc_csize()

| void * mi_theap_malloc_csize | ( | mi_theap_t * | theap, | | | | size_t | size ) |

mi_theap_zalloc_csize()

| void * mi_theap_zalloc_csize | ( | mi_theap_t * | theap, | | | | size_t | size ) |

mi_zalloc_csize()

| void * mi_zalloc_csize | ( | size_t | size | ) | |

  • Generated by 1.11.0