---
name: "memalloc.h"
section: "3"
platform: "linux"
package: "libcoin80-doc"
version: "3.1.4~abc9f50-7"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/memalloc.h"
---

# memalloc.h(3)

## NAME

memalloc.h -

## SYNOPSIS

`#include <Inventor/C/basic.h>`\
 `#include <stdarg.h>`\

### Typedefs

typedef struct cc\_memalloc **cc\_memalloc**\
 typedef int **cc\_memalloc\_strategy\_cb** (const int numunits\_allocated)\

### Functions

cc\_memalloc \* **cc\_memalloc\_construct** (const unsigned int unitsize)\
 void **cc\_memalloc\_destruct** (cc\_memalloc \*allocator)\
 void \* **cc\_memalloc\_allocate** (cc\_memalloc \*allocator)\
 void **cc\_memalloc\_deallocate** (cc\_memalloc \*allocator, void \*ptr)\
 void **cc\_memalloc\_clear** (cc\_memalloc \*allocator)\
 void **cc\_memalloc\_set\_strategy** (cc\_memalloc \*allocator, cc\_memalloc\_strategy\_cb \*cb)\

## Function Documentation

### cc\_memalloc\* cc\_memalloc\_construct (const unsigned intunitsize)

Construct a memory allocator. Each allocated unit will be *unitsize* bytes.

### void cc\_memalloc\_destruct (cc\_memalloc \*allocator)

Destruct *allocator*, freeing all memory used.

### void\* cc\_memalloc\_allocate (cc\_memalloc \*allocator)

Allocate a memory unit from *allocator*.

### void cc\_memalloc\_deallocate (cc\_memalloc \*allocator, void \*ptr)

Deallocate a memory unit. *ptr* must have been allocated using **cc\_memalloc\_allocate()**, of course.

### void cc\_memalloc\_clear (cc\_memalloc \*allocator)

Free all memory allocated by *allocator*.

### void cc\_memalloc\_set\_strategy (cc\_memalloc \*allocator, cc\_memalloc\_strategy\_cb \*cb)

Sets the allocator strategy callback.  should be a function that returns the number of units to allocated in a block, based on the number of units currently allocated.

The default strategy is to just return the number of units allocated (which will successively double the internal memory chunk sizes), unless the number of units allocated is less than 64, then 64 is returned.

## Author

Generated automatically by Doxygen for Coin from the source code.
