Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

chunkallocator.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Data Structures

struct  chunkallocator
 Chunkallocator structure. More...

struct  chunkblock
 Chunkblock. More...


Defines

#define CHUNKBLOCK_MINSIZE   32
 Minimum of Chunkblock.


Functions

chunkallocatorchunkallocator_new (size_t binsize)
 Create a new chunkallocator.

void chunkallocator_destroy (chunkallocator *a)
 Destroy chunkallocator.

void * chunkallocator_alloc (chunkallocator *a)
 Allocate chunk.

void gnn_chunkallocator_free (chunkallocator *a, void *memblock)


Function Documentation

void* chunkallocator_alloc chunkallocator   a
 

This function returns a pointer to a new allocated memory chunk. The chunkallocator handles the memory management to do so, and of course, to allocate a chunk of the correct size efficiently.

Internally, the allocator checks if there are dead chunks, that is, previously deallocated chunks that lie fragmented in the memory. If so it assigns its memory. If not, then it returns new memory from the memory pool. If there isn't any memory available either, then it creates a new chunkblock.

Parameters:
a  A pointer to a chunkallocator.
Returns:
A pointer to new memory.

Definition at line 236 of file chunkallocator.c.

void chunkallocator_destroy chunkallocator   a
 

This function frees the memory of the chunkallocator, freeing the structure and all its chunk/memory blocks.

Parameters:
a  A pointer to a chunkallocator.

Definition at line 205 of file chunkallocator.c.

chunkallocator* chunkallocator_new size_t    binsize
 

This function creates a new chunkallocator for bins of the given size.

Parameters:
binsize  The size of the bins that the allocator should allocate.
Returns:
A pointer to a new created chunkallocator.

Definition at line 146 of file chunkallocator.c.

void gnn_chunkallocator_free chunkallocator   a,
void *    memblock
 


Generated on Sun Jun 13 20:50:14 2004 for libgnn Gradient Retropropagation Machine Library by doxygen1.2.18