Memory leaks will cause your device to crash after a period of time once it runs out of memory. A quick way to find out if your application has a memory leak(s) is to monitor it with top:
If you see the %MEM increase over time for no particular reason, then you’ve got a memory leak. However, it might be tricky to isolate where the issue occurs exactly. The first thing to do is the review your source code for the following: Malloced memory is always freed fopen is always followed by fclose, and open by close scandir calls are properly freed Threads are properly terminated with pthread_cancel & pthread_join or pthread_detach, etc… If after a code review you cannot find the reason for the memory leak, use the following piece of code:
The memory usage is displayed in numbers of pages. Usually, one page is 4096 […]