Exemplo n.º 1
0
static inline Void _FNPROF_InitHeap()
{
  HeapMem_Params heapMemPrm;

  UTILS_assert((FNPROF_GBLINFO.hProfileHeapExtMem == NULL));
  /* create memory pool heap  */

  HeapMem_Params_init(&heapMemPrm);

  heapMemPrm.buf = cProfileHeapExtMem;
  heapMemPrm.size = sizeof(cProfileHeapExtMem);

  FNPROF_GBLINFO.hProfileHeapExtMem = HeapMem_Handle_upCast(HeapMem_create(&heapMemPrm, NULL));

  UTILS_assert((FNPROF_GBLINFO.hProfileHeapExtMem != NULL));

  UTILS_assert((FNPROF_GBLINFO.hProfileHeapIntMem == NULL));
  /* create memory pool heap  */

  HeapMem_Params_init(&heapMemPrm);

  heapMemPrm.buf = cProfileHeapIntMem;
  heapMemPrm.size = sizeof(cProfileHeapIntMem);

  FNPROF_GBLINFO.hProfileHeapIntMem = HeapMem_Handle_upCast(HeapMem_create(&heapMemPrm, NULL));

  UTILS_assert((FNPROF_GBLINFO.hProfileHeapIntMem != NULL));

}
Exemplo n.º 2
0
/*
 *  ======== task1Fxn ========
 */
Void task1Fxn(UArg arg0, UArg arg1)
{
    Ptr bufs[TASK1NUMBUFS];
    IHeap_Handle heap = HeapMem_Handle_upCast(task1Heap);

    System_printf("Initial task1 heap status\n");

    /* print initial task1Heap status */
    printHeapStats(heap);

    bufs[0] = Memory_alloc(heap, TASK1BUFSIZE0, 0, NULL);

    bufs[1] = Memory_alloc(heap, TASK1BUFSIZE1, 0, NULL);

    bufs[2] = Memory_alloc(heap, TASK1BUFSIZE2, 0, NULL);

    Memory_free(heap, bufs[1], TASK1BUFSIZE1);
    Memory_free(heap, bufs[2], TASK1BUFSIZE2);

    bufs[3] = Memory_alloc(heap, TASK1BUFSIZE3, 0, NULL);

    Memory_free(heap, bufs[0], TASK1BUFSIZE0);
    Memory_free(heap, bufs[3], TASK1BUFSIZE3);

    System_printf("Final task1 heap status\n");

    /* print task1Heap status */
    printHeapStats(heap);

    System_printf("Task1 Complete\n");
}