# How to use Valgrind on WP76 to investigate memory leaks

**URL:** <https://forum.legato.io/t/how-to-use-valgrind-on-wp76-to-investigate-memory-leaks/5217>\
**Category:** Legato Linux distribution (Yocto project)\
**Created:** [May 29, 2020, 3:27am UTC](https://forum.legato.io/t/how-to-use-valgrind-on-wp76-to-investigate-memory-leaks/5217 "2020-05-29T03:27:06Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [May 29, 2020, 5:31am UTC](https://forum.legato.io/t/how-to-use-valgrind-on-wp76-to-investigate-memory-leaks/5217/2 "2020-05-29T05:31:56Z")

</div>

You can try the procedure below on WP76 R13.3:

1. download the yocto source code
2. open ./meta-swi/meta-swi-mdm9x28/recipes-core/images/mdm9x28-image.inc and add the following line:

IMAGE\_INSTALL\_append = " valgrind"

1. make the yocto image

2. there will be error to make the yocto.cwe as it is too big. Instead we need to transfer the binary to module’s RAM area

3. on module, type the following:  
mkdir /tmp/valgrind

4. on PC:

scp ./build\_bin/tmp/work/armv7a-neon-poky-linux-gnueabi/valgrind/3.13.0-r0/image/usr/bin/\* [root@192.168.2.2](mailto:root@192.168.2.2):/tmp/valgrind

scp ./build\_bin/tmp/work/armv7a-neon-poky-linux-gnueabi/valgrind/3.13.0-r0/image/usr/lib/valgrind/memcheck-arm-linux [root@192.168.2.2](mailto:root@192.168.2.2):/tmp/valgrind

1. on module, type the following:  
chmod -R 777 /tmp/valgrind  
export VALGRIND\_LIB=/tmp/valgrind

2. run the program by:  
root@swi-mdm9x28-wp:/tmp/valgrind# /tmp/valgrind/valgrind  
valgrind: no program specified  
valgrind: Use --help for more information.

---

_[View the full topic](https://forum.legato.io/t/how-to-use-valgrind-on-wp76-to-investigate-memory-leaks/5217)._
