This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

_init_box requires 16 bytes not 12

I appears that the memory allocation function uese 16 bytes, not 12 as stated in the documentation.

#define NUM_BOXES 5
U32 mpool[(NUM_BOXES * sizeof(U32)/4) + 3];


fails the assert in the following code
where

#define NUM_BOXES 5
U32 mpool[(NUM_BOXES * sizeof(U32)/4) + 4];


passes

void membox_test (void) {
    U8 *box;
    U8 i;
    _init_box (mpool, sizeof (mpool), sizeof(U32));

    while(1)
    {
        box  = _alloc_box (mpool);
        if(box == NULL)break;
        i++;
    }
   assert(i==NUM_BOXES)
}

can anyone confirm this?

0