[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]

Exec provides the routines AllocEntry() and FreeEntry() to allocate
multiple memory blocks in a single call. AllocEntry() accepts a data
structure called a MemList, which contains the information about the size
of the memory blocks to be allocated and the requirements, if any, that
you have regarding the allocation. The MemList structure is found in the
include file <exec/memory.h> and is defined as follows:

    struct MemList
        struct Node     ml_Node;
        UWORD           ml_NumEntries;      /* number of MemEntrys */
        struct MemEntry ml_ME[1];           /* where the MemEntrys begin*/

    allows you to link together multiple MemLists.  However, the node is
    ignored by the routines AllocEntry() and FreeEntry().

    tells the system how many MemEntry sets are contained in this
    MemList.  Notice that a MemList is a variable-length structure and
    can contain as many sets of entries as you wish.

The MemEntry structure looks like this:

    struct MemEntry
        union {
            ULONG   meu_Reqs;   /* the AllocMem requirements */
            APTR    meu_Addr;   /* address of your memory */
            } me_Un;
        ULONG   me_Length;      /* the size of this request */

 Sample Code for Allocating Multiple Memory Blocks 
 Result of Allocating Multiple Memory Blocks 
 Multiple Memory Blocks and Tasks 
 Summary of Multiple Memory Blocks Allocation Routines