Memory check - Mtrace vs Valgrind (how long does it take)
Mtrace vs Valgrind mtrace와 valgrind 둘 중 어느것이 memory 오류 검출 시 걸리는 시간을 비교했습니다. 테스트 code 1. (mtrace 사용 시 주석 해제 후 재빌드) #include <stdio.h> #include <stdlib.h> //#include <mcheck.h> int main () { char * test; for ( int i = 0 ; i < 10000 ; i ++ ) { //mtrace(); test = malloc( 10 ); free(test); //muntrace(); } printf( "hello world \n " ); return 0 ; } 속도 비교 일반 실행 -bash-4.2 $ time ./hello hello world real 0m0.002s user 0m0.000s sys 0m0.002s mtrace 사용 시 -bash-4.2 $ time ./hello hello world real 0m0.234s user 0m0.039s sys 0m0.188s valgrind 사용 시 -bash-4.2 $ time valgrind --leak-check = full ./hello == 15079 == Memcheck, a memory error detector == 15079 == Copyright ( C ) 2002-2013, and GNU GPL ' d, by Julian Seward et al. == 15079 == Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info == 15079 == Command: ./hello == 15079 == hello world == 15079 == == 15079 == ...