Coin Logo http://www.coin3d.org/
http://www.kongsberg.com/kogt/

Typedefs | Functions
memalloc.h File Reference
#include <Inventor/C/basic.h>
#include <stdarg.h>

Go to the source code of this file.

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 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. 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.


Copyright © by Kongsberg Oil & Gas Technologies. All rights reserved.

Generated for Coin by Doxygen