Simple Malloc implementation
[Memory Allocation]

Collaboration diagram for Simple Malloc implementation:

Functions

void * malloc (size_t size)
 Allocate size bytes of dynamic memory.
void * zalloc (size_t size)
 Allocate size bytes of zero-initialized dynamic memory.
static void free (void *ptr)
 Free a memory object previously allocated by malloc().

Detailed Description

This implementation of malloc() is very lightweight, but it does not include free(), realloc() or any other fancy features. It is useful when including drivers that rely on malloc() during initialization, but not for general dynamic memory management.


Function Documentation

static void free ( void *  ptr  )  [inline, static]

Free a memory object previously allocated by malloc().

This will return the memory at ptr back to the dynamic memory allocator. ptr must point to a block of memory previously returned by malloc() or any of the associated functions, and must not have been passed to free() since then.

Note:
This particular implementation of free() does nothing.
Parameters:
ptr Pointer to the memory object to be freed.

Definition at line 70 of file simple.h.

void* malloc ( size_t  size  ) 

Allocate size bytes of dynamic memory.

Definition at line 52 of file malloc_simple.c.

References assert, cpu_sram_pool, PHYS_MAP_WRBACK, PHYS_MAP_WRBUF, PHYSMEM_ALLOC_ERR, physmem_alloc_low(), and physmem_map().

Referenced by tsfs_init(), and zalloc().

void* zalloc ( size_t  size  ) 

Allocate size bytes of zero-initialized dynamic memory.

Definition at line 68 of file malloc_simple.c.

References malloc(), and memset().

Generated on Thu Apr 29 15:18:23 2010 for display-training by  doxygen 1.6.3