On 6/19/2019 10:34 PM, subhasish Karmakar wrote:
Hi,

I have an application running on embedded linux.
After running for hours my application causes out of memory issue.
How can I get memory leak report periodically when the application is running?
It's a process with "while(1)" loop.

Regards,
Subhasish


Valgrind reports leaks when the program exits.  Because leaks are more than just memory that your program no longer references, there isn't a good way to report leaks before your program exits.

Your best bet is to build a version of your program that exits sooner, then run your embedded system until the program exits (vs. runs out of memory).  Unless your code leaks memory in very unusual circumstances, running it under valgrind for a few minutes should give you a lot of clues.  Figure out how many times the "while (1)" infinite loop iterates before the crash, divide that number by 100 or 1000, then replace the infinite loop with a "for (i = 0; i < count; ++i)" loop.

Remember, your program will run slower under valgrind, so if your embedded system has strict real-time constraints it might not work properly.

--
    David Chapman      dcchap...@acm.org
    Chapman Consulting -- San Jose, CA
    EDA Software Developer, Expert Witness
    www.chapman-consulting-sj.com
    2018-2019 Chair, IEEE Consultants' Network of Silicon Valley



_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to