Jump to content
  • 0

malloc, calloc and free on basys3 and nexys video


Zzingoh

Question

Hi,

 

I have an Vitis application that is using calloc and free frequently. 

Calloc is working fine just one time and second time it returns NULL

 

Do you have any idea on this?

 

Here is my design information.

 

On Vivado, I am using 64KB local memory when I created microblaze 

In Vivado - Basys3 -  64KB local memory

In Vitis - standalone application, here are two functions. So Set() called first and then Get() called as a pair. 

1st pair : Set()->Get() works

2nd pair : Set()-> falied due to cmalloc error - Null returned!!!

 

void Get() 

{

   if (get.body)
      free(get.body);

}

void Set()
{

    pBody = (u8 *)calloc(len, sizeof(u8));
    if (!pBody)
    {
        xil_printf("cmalloc error - NULL returned \r\n");
        return;
    }

   get.body = pBody;

}

 

Is this because of no available heap size? how to check and increase it?

 

Thanks

 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...