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)

Typedef Documentation

  struct cc_memalloc cc_memalloc
A type definition for the memory allocator structure.

  int cc_memalloc_strategy_cb
The type definition for the memory allocator strategy callback function.

Function Documentation

  cc_memalloc* cc_memalloc_construct (const unsigned int unitsize)
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. cb 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.