[ Maverik Level 1 functions ]

#

mav_malloc

mav_malloc, mav_calloc, mav_free

## Summary

Maverik dynamic memory management.

## Syntax

void *mav_malloc(int amount);

void *mav_calloc(int nelem, int elemsize);

void mav_free(void *d);

## Description

For convenience, Maverik provides wrapper functions to the standard system malloc, calloc and free functions. The wrappers check for out-of-memory errors.

mav_malloc attempts to malloc `amount` bytes of memory, and if successful returns a pointer to the base of the allocated memory. If unsuccessful, it calls exit(1).

mav_calloc performs the same function as the system calloc but provides the error-checking described above.

mav_free calls free with argument `d`.

Back to the index page.