AnsweredAssumed Answered

How to Check Memory Leak of Array

Question asked by ATHMESH NANDAKUMAR on Dec 7, 2019
Latest reply on Dec 8, 2019 by John Adriaan

Hi,

 

 

 

I'm using LPC1754 with 128kB flash and RAM of 32kB. I'm using mcuxpresso IDE.

 

 I've used only 37% of RAM while compiling the code. I'm using embedded c language.

 

I've come to know that there's a chance of memoryleak, i.e. values of memory changes abnormally without our consent. Some array gets filled with values of other Array or value.

 

 

for eg: I'm using character array of size 1362 and another of size 260  declared as following.

 

 

char Buffer[1362], which is declared globally.

char response[260], which is also declared globally.

sometimes response, which is cleared by using memset function, gets filled with some data present in Buffer. I checked for shortage of array size. which is not seen.

 

I found the same issue with some other variables  too, whose value gets changed without our consent, which is causing serious issue in logic.

 

Some points that I'm concerned about are:

 

1. heap and stacksize How to modify the size so that the code works without any issue in memory leak.

2. Array size: Which is  not found to give any impact at present. But, would like to know steps to check if the array size is getting filled up.

 

Thanks and Regards,
Athmesh Nandakumar   

Outcomes