use valgrind to fix mem leak