/*
 *               Copyright (C) 2005, BroadOn Communications Corp.
 *
 *  These coded instructions, statements, and computer programs contain
 *  unpublished  proprietary information of BroadOn Communications Corp.,
 *  and  are protected by Federal copyright law. They may not be disclosed
 *  to  third  parties or copied or duplicated in any form, in whole or in
 *  part, without the prior written consent of BroadOn Communications Corp.
 *
 */

/* Example that allocates and frees memory */
#include <stdio.h> /* for printf */

#include <ios.h>
#include <iostypes.h>

#define NUM_ITER 10
#define ALLOC_SIZE 4*IOS_DDR_PAGE_SIZE
void
mem(u32 id)
{
  u32 *tst;
  int i = 0;
  for ( i = 0; i < NUM_ITER; ++i ) {
    tst = IOS_Alloc(ALLOC_SIZE/IOS_DDR_PAGE_SIZE);
    printf("itr[%d]:allocated %d pages\n", i, ALLOC_SIZE/IOS_DDR_PAGE_SIZE);
    if (NULL != tst) 
      IOS_Free(tst);
    printf("itr[%d]:freed %d pages\n", i, ALLOC_SIZE/IOS_DDR_PAGE_SIZE);
  }
  IOS_DebugMemDump();
  IOS_ThreadExit(0);
}
