Memory allocation


Functions

void * os_alloc (size_t size)
void * os_alloc_nonzeroed (size_t size)
void os_free (void *ptr)
void * os_alloc_big (size_t size)
void os_free_big (void *ptr)

Function Documentation

void* os_alloc ( size_t  size  ) 

Allocate a buffer of memory from the heap (or similar) and zero it.

The allocated memory will be physically contiguous and therefore suitable for DMA.

This is intended for small size allocations less than a page; larger, multi-page allocations are permitted but should be avoided. See os_alloc_big() for an alternative for large allocations.

The memory should be freed with os_free().

Callable from: thread context.

Parameters:
size memory size to allocate in octets.
Returns:
pointer to the allocated memory; or NULL if no memory could be allocated.

void* os_alloc_big ( size_t  size  ) 

Allocate memory for large (multi-page) buffers.

The allocated memory is not zeroed. It may not be physically contiguous and is not suitable for DMA.

The memory should be freed with os_free_big().

void* os_alloc_nonzeroed ( size_t  size  ) 

Allocate a buffer of memory from the heap (or similar).

Like os_alloc() but the buffer may not be zeroed.

Parameters:
size memory size to allocate in octets.
Returns:
pointer to the allocated memory; or NULL if no memory could be allocated.

void os_free ( void *  ptr  ) 

Free memory allocated with os_alloc().

This function does nothing if ptr is NULL.

Callable from: any context.

Parameters:
ptr pointer to the buffer to free (or NULL).

void os_free_big ( void *  ptr  ) 

Free memory allocated with os_alloc_big().

This function does nothing if ptr is NULL.

Callable from: any context.

Parameters:
ptr pointer to the buffer to free (or NULL).


Generated on Wed Oct 27 15:14:03 2010 for oska by  doxygen 1.5.5