cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Newbie
Newbie
167 Views
Registered: ‎11-04-2019

Zynq7020 memory leakage in Linux while receiving periodic messages from FreeRTOS

Hi ;

I am using a Zynq7020 module in a prototype to monitor the thickness of powdered metallic profiles using an ultrasonic sensor.  I am performing now performance testing. Unfortunately, Linux free memory is constantly dropping so I suspected a memory leakage in the software.

 

I reduced my test to the following basic operation:

CPU1/FreeRTOS is sending every 80 ms a message to CPU1/Linux(generated with petalinux 2018.2). My code does not contain any dynamic memory allocation.

The following is the essence of the code:

FreeRTOS/CPU1 side:

ocm_send_cpu1beat() function is called every 80 ms via a timer callback

void ocm_send_cpu1beat(){

  struct _payload *s_buff=NULL;

  uint32_t s_size;

  s_buff = rpmsg_get_tx_payload_buffer(app_rp_chnl, &s_size, 0);

  ......

s_buff->length=480;

s_buff->crc16=0;

..........

s_buff->crc16=makeChecksum_CRC16((int8_t*)s_buff,s_buff->length);

rpmsg_send_nocopy(app_rp_chnl, s_buff, s_buff->length);

}

 

Linux side:

Loaded modules

modprobe rpmsg_user_dev_driver
modprobe zynq_remoteproc

 

Code:

fd = open("/dev/rpmsg0", O_RDWR | O_NONBLOCK);

........

*bytes_rcvd=0;
memset(readbuf,0,buffsize);
do{
usleep(pollingPeriod);
*bytes_rcvd = read(fd, readbuf ,500);
} while (*bytes_rcvd <= 0);

 

Free memory estimation:

free -m called periodically in Linux, we are loosing around 40 MB every hour.  The loss is much bigger when the complete system is running.

Any advice?

 

Thank you in advance

 

 

0 Kudos
0 Replies