Recent Changes - Search:

edit SideBar

UsingValgrindForMemoryLeak

Based on our generated code, we discovered there was a memory leak. While generating code for a simple model to blink the LED on the mbed board, the LED would not blink infinitely many times and mbed would notify us of a runtime error by flashing red. (more info here: https://developer.mbed.org/handbook/Debugging).

In order to help determine the cause of our memory leak, we used Valgrind which can detect memory errors. Valgrind can be downloaded from: http://valgrind.org/downloads/current.html.

For users using Mac OS X Yosemite, there is not a current stable release. You can download a developer version from svn:

    svn co svn://svn.valgrind.org/valgrind/trunk valgrind  
    cd valgrind
    ./autogen.sh
    ./configure
    make
    make install

Make sure to have the latest version of Xcode. If you encounter errors during the "make", use the command in the terminal: xcode-select --install

More resources for debugging install: http://stackoverflow.com/questions/26564125/yosemite-and-valgrind http://ranf.tl/2014/11/28/valgrind-on-mac-os-x-10-10-yosemite/ http://oldpanda.net/2014/11/18/Install-Valgrind-on-Mac/#solution

Command for running a Valgrind test (SimpleFSM refers to a directory generated by C not mbed specific since we need executable to use Valgrind, so in model use generatorPackageList: generic.program.procedural.c ): valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes ./SimpleFSM

Edit - History - Print - Recent Changes - Search
Page last modified on March 29, 2015, at 01:22 AM