[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*/
    };

Node
    allows you to link together multiple MemLists.  However, the node is
    ignored by the routines allocentry() and freeentry().

ml_NumEntries
    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