#! /bin/bash
# USE vagrind to test memory leak
#valgrind command
VALCMD=/usr/bin/valgrind
#valgrind preload library
PRELIB="../src/.libs/libvalmem.so.1"
#valgrind options --trace-children=yes
VALOPTIONS='--tool=memcheck --leak-check=full --show-reachable=yes'
#program
CMD=.libs/lt-mem_leak
test -x $CMD || CMD=.libs/mem_leak
#program lib path
LDPATH=../src/.libs
LD_LIBRARY=$LDPATH LD_PRELOAD=$PRELIB $VALCMD $VALOPTIONS $CMD -1
LD_LIBRARY=$LDPATH LD_PRELOAD=$PRELIB $VALCMD $VALOPTIONS $CMD -2
LD_LIBRARY=$LDPATH LD_PRELOAD=$PRELIB $VALCMD $VALOPTIONS $CMD -3
LD_LIBRARY=$LDPATH LD_PRELOAD=$PRELIB $VALCMD $VALOPTIONS $CMD -4
阅读(1309) | 评论(0) | 转发(0) |