valgrind 简单使用

来源:互联网 发布:守望先锋看数据 编辑:程序博客网 时间:2024/06/14 04:10

valgrind  --leak-check=full     --log-file=tmp.log    ./xxx

[root@sys1 ops-port-alarm]# more tmp.log.12766 
==12766== Memcheck, a memory error detector.
==12766== Copyright (C) 2002-2006, and GNU GPL'd, by Julian Seward et al.
==12766== Using LibVEX rev 1658, a library for dynamic binary translation.
==12766== Copyright (C) 2004-2006, and GNU GPL'd, by OpenWorks LLP.
==12766== Using valgrind-3.2.1, a dynamic binary instrumentation framework.
==12766== Copyright (C) 2000-2006, and GNU GPL'd, by Julian Seward et al.
==12766== For more details, rerun with: -v
==12766== 
==12766== My PID = 12766, parent PID = 13448.  Prog and args are:
==12766==    /home/zengwenjie/ops-port-alarm/port-alarm
==12766==    /home/zengwenjie/ops-port-alarm/configure.file
==12766== 
==12766== Thread 5:
==12766== Invalid read of size 2
==12766==    at 0x405F04: compose_trans_string (transfer.c:96)
==12766==    by 0x40611A: transfer_info (transfer.c:119)
==12766==    by 0x402097: check_port_func (main.c:213)
==12766==    by 0x31006064A6: start_thread (in /lib64/libpthread-2.5.so)
==12766==    by 0x30FFED3C2C: clone (in /lib64/libc-2.5.so)
==12766==  Address 0x4E86744 is 1,044 bytes inside a block of size 1,052 free'd
==12766==    at 0x4A0541E: free (vg_replace_malloc.c:233)
==12766==    by 0x401AEB: release_hash_node (main.c:83)
==12766==    by 0x4021BB: destroy_pthread_workers (main.c:264)
==12766==    by 0x4023E4: update_policy (main.c:323)
==12766==    by 0x40242D: pmon_wait (main.c:339)
==12766==    by 0x40254D: start_monitor (main.c:373)
==12766==    by 0x4025BD: main (main.c:388)
==12766== 
==12766== Invalid read of size 2
==12766==    at 0x405F15: compose_trans_string (transfer.c:96)
==12766==    by 0x40611A: transfer_info (transfer.c:119)
==12766==    by 0x402097: check_port_func (main.c:213)
==12766==    by 0x31006064A6: start_thread (in /lib64/libpthread-2.5.so)
==12766==    by 0x30FFED3C2C: clone (in /lib64/libc-2.5.so)
==12766==  Address 0x4E86748 is 1,048 bytes inside a block of size 1,052 free'd
==12766==    at 0x4A0541E: free (vg_replace_malloc.c:233)
==12766==    by 0x401AEB: release_hash_node (main.c:83)
==12766==    by 0x4021BB: destroy_pthread_workers (main.c:264)
==12766==    by 0x4023E4: update_policy (main.c:323)
==12766==    by 0x40242D: pmon_wait (main.c:339)
==12766==    by 0x40254D: start_monitor (main.c:373)
==12766==    by 0x4025BD: main (main.c:388)
==12766== 
==12766== Invalid read of size 1
==12766==    at 0x4A066C2: strlen (mc_replace_strmem.c:246)
==12766==    by 0x30FFE46B68: vfprintf (in /lib64/libc-2.5.so)
==12766==    by 0x30FFE63B48: vsprintf (in /lib64/libc-2.5.so)

可见   compose_trans_string (transfer.c:96)有问题


原创粉丝点击