mi-malloc: Zero initialized re-allocation

| mi-malloc 1.8/2.1 |

Loading...
Searching...
No Matches
Functions
Zero initialized re-allocation

Re-allocation of zero initialized blocks. More...

## Functions
void * | mi_recalloc (void *p, size_t count, size_t size)
| Re-allocate memory to count elements of size bytes, with extra memory initialized to zero.
void * | mi_rezalloc (void *p, size_t newsize)
void * | mi_rezalloc_aligned (void *p, size_t newsize, size_t alignment)
void * | mi_rezalloc_aligned_at (void *p, size_t newsize, size_t alignment, size_t offset)
void * | mi_recalloc_aligned (void *p, size_t newcount, size_t size, size_t alignment)
void * | mi_recalloc_aligned_at (void *p, size_t newcount, size_t size, size_t alignment, size_t offset)
void * | mi_heap_rezalloc (mi_heap_t *heap, void *p, size_t newsize)
void * | mi_heap_recalloc (mi_heap_t *heap, void *p, size_t newcount, size_t size)
void * | mi_heap_rezalloc_aligned (mi_heap_t *heap, void *p, size_t newsize, size_t alignment)
void * | mi_heap_rezalloc_aligned_at (mi_heap_t *heap, void *p, size_t newsize, size_t alignment, size_t offset)
void * | mi_heap_recalloc_aligned (mi_heap_t *heap, void *p, size_t newcount, size_t size, size_t alignment)
void * | mi_heap_recalloc_aligned_at (mi_heap_t *heap, void *p, size_t newcount, size_t size, size_t alignment, size_t offset)

## Detailed Description

Re-allocation of zero initialized blocks.

The zero-initialized re-allocations are only valid on memory that was originally allocated with zero initialization too, e.g. `mi_calloc`, `mi_zalloc`, `mi_zalloc_aligned` etc. see also https://github.com/microsoft/mimalloc/issues/63#issuecomment-508272992

## Function Documentation

## ◆ mi_heap_recalloc()

void * mi_heap_recalloc | ( | mi_heap_t * | heap,
|  | void * | p,
|  | size_t | newcount,
|  | size_t | size )

## ◆ mi_heap_recalloc_aligned()

void * mi_heap_recalloc_aligned | ( | mi_heap_t * | heap,
|  | void * | p,
|  | size_t | newcount,
|  | size_t | size,
|  | size_t | alignment )

## ◆ mi_heap_recalloc_aligned_at()

void * mi_heap_recalloc_aligned_at | ( | mi_heap_t * | heap,
|  | void * | p,
|  | size_t | newcount,
|  | size_t | size,
|  | size_t | alignment,
|  | size_t | offset )

## ◆ mi_heap_rezalloc()

void * mi_heap_rezalloc | ( | mi_heap_t * | heap,
|  | void * | p,
|  | size_t | newsize )

## ◆ mi_heap_rezalloc_aligned()

void * mi_heap_rezalloc_aligned | ( | mi_heap_t * | heap,
|  | void * | p,
|  | size_t | newsize,
|  | size_t | alignment )

## ◆ mi_heap_rezalloc_aligned_at()

void * mi_heap_rezalloc_aligned_at | ( | mi_heap_t * | heap,
|  | void * | p,
|  | size_t | newsize,
|  | size_t | alignment,
|  | size_t | offset )

## ◆ mi_recalloc()

void * mi_recalloc | ( | void * | p,
|  | size_t | count,
|  | size_t | size )

Re-allocate memory to count elements of size bytes, with extra memory initialized to zero.

Parameters

  p | Pointer to a previously allocated block (or NULL).
  count | The number of elements.
  size | The size of each element.

Returns
  A pointer to a re-allocated block of count * size bytes, or NULL if out of memory or if count * size overflows.

If there is no overflow, it behaves exactly like `mi_rezalloc(p,count*size)`.

See also
  mi_reallocn()
  recallocarray() (on BSD).

## ◆ mi_recalloc_aligned()

void * mi_recalloc_aligned | ( | void * | p,
|  | size_t | newcount,
|  | size_t | size,
|  | size_t | alignment )

## ◆ mi_recalloc_aligned_at()

void * mi_recalloc_aligned_at | ( | void * | p,
|  | size_t | newcount,
|  | size_t | size,
|  | size_t | alignment,
|  | size_t | offset )

## ◆ mi_rezalloc()

void * mi_rezalloc | ( | void * | p,
|  | size_t | newsize )

## ◆ mi_rezalloc_aligned()

void * mi_rezalloc_aligned | ( | void * | p,
|  | size_t | newsize,
|  | size_t | alignment )

## ◆ mi_rezalloc_aligned_at()

void * mi_rezalloc_aligned_at | ( | void * | p,
|  | size_t | newsize,
|  | size_t | alignment,
|  | size_t | offset )