OAR

RTEMS GNU Tools On-Line Library


Implementation

PREV UP next Bookshelf

Chapter 2: Implementation

The mmalloc functions contain no internal static state. All mmalloc internal data is allocated in the mapped in region, along with the user data that it manages. This allows it to manage multiple such regions and to ``pick up where it left off'' when such regions are later dynamically mapped back in.

In some sense, malloc has been ``purified'' to contain no internal state information and generalized to use multiple memory regions rather than a single region managed by sbrk. However the new routines now need an extra parameter which informs mmalloc which memory region it is dealing with (along with other information). This parameter is called the malloc descriptor.

The functions initially provided by mmalloc are:

void *mmalloc_attach (int fd, void *baseaddr);
void *mmalloc_detach (void *md);
int mmalloc_errno (void *md);
int mmalloc_setkey (void *md, int keynum, void *key);
void *mmalloc_getkey (void *md, int keynum);

void *mmalloc (void *md, size_t size);
void *mrealloc (void *md, void *ptr, size_t size);
void *mvalloc (void *md, size_t size);
void mfree (void *md, void *ptr);
  • Compatibility Backwards Compatibility
  • Functions Function Descriptions

  • PREV UP next Bookshelf

    Packaging copyright © 1988-2000 OAR Corporation
    Context copyright by each document's author. See Free Software Foundation for information.