AnsweredAssumed Answered

Problem with heap allocation on BF525

Question asked by anjana on Aug 23, 2010
Latest reply on Feb 22, 2011 by CraigG

Hi,

 

We are using BF525 processor in our application where we want to set up our own heap for dynamic memory allocation.But we are not able to allocate it. The problem is when we are trying to execute the instruction  "heap_index = heap_lookup(id);   //heap index"  it is continously  running which is not coming out of the instruction. The same heap allocation is working for BF532 processor.

 

Can you please tell me what could be the reason for it.

 

 

 

This is the piece of code to set up heap and allocate some bytes in that heap memory

 

id=setup_heap(0x01000000,2097151);   //setup for heap(mention start address for ur heap and size of heap)

 

heap_index = heap_lookup(id);   //heap index

 

if (heap_index < 0) {

 

   printf("Heap %d is not setup\n",0);

 

   exit(EXIT_FAILURE);

 

}

 

buffer = heap_malloc(heap_index,1310720 * sizeof(unsigned char)); //allocating memory
dum=buffer;
if (buffer == NULL) {

 

   printf("heap_malloc failed to allocate memory\n");

 

}

free(buffer);

 

 

 

Regards

Anjana

Outcomes