--- Martin Jenkins <[EMAIL PROTECTED]>写道: > mycmos wrote: > > When I use cat /proc/meminfo, I found the MemFree > is > > decreasing. Does that means some degree memory > leak to > > Sqlite2.8.17? > > No. ;) > > If you run "ps -ef" or "top" you'll see a list of > all of the processes > running on your machine. How could you associate > changes in MemFree with > any one of those processes? Short answer - you > can't. ;) > > I ran sqlite's test suite last week and (IIRC) it > has about 20,000 test > cases. I didn't watch the whole test but I'd be > surprised if there > wasn't a memory leak test in there somewhere and > given the number of > people using sqlite I'm sure a leak in 2.8.17 would > have been found and > fixed by now. > > Martin > > PS Usual stuff about 2.8.17 being old and 3.3.6 > being new goes here. >
I believe the memory leak exists. The following is excerpt from sqlite-3.3.6 in valgrind (In fact, the sqlite-2.8.17 in valgrind is similar): [EMAIL PROTECTED] /data/lfs/sqlite-3.3.6]# valgrind --leak-check=full ./sqlite3 ==11762== Memcheck, a memory error detector. ==11762== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al. ==11762== Using LibVEX rev 1575, a library for dynamic binary translation. ==11762== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP. ==11762== Using valgrind-3.1.1, a dynamic binary instrumentation framework. ==11762== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al. ==11762== For more details, rerun with: -v ==11762== ==11765== ==11765== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 16 from 1) ==11765== malloc/free: in use at exit: 24,808 bytes in 1,109 blocks. ==11765== malloc/free: 2,831 allocs, 1,722 frees, 107,119 bytes allocated. ==11765== For counts of detected errors, rerun with: -v ==11765== searching for pointers to 1,109 not-freed blocks. ==11765== checked 129,076 bytes. ==11765== ==11765== 27 bytes in 1 blocks are definitely lost in loss record 1 of 4 ==11765== at 0x401B46D: malloc (vg_replace_malloc.c:149) ==11765== by 0x80958E1: xmalloc (in /bin/bash) ==11765== by 0x8069D65: execute_command_internal (in /bin/bash) ==11765== by 0x8099EBB: parse_and_execute (in /bin/bash) ==11765== by 0x807E28A: command_substitute (in /bin/bash) ==11765== by 0x8081F74: (within /bin/bash) ==11765== by 0x8081C03: (within /bin/bash) ==11765== by 0x80835A1: (within /bin/bash) ==11765== by 0x806A901: execute_command_internal (in /bin/bash) ==11765== by 0x806C67F: execute_command (in /bin/bash) ==11765== by 0x806D7C3: (within /bin/bash) ==11765== by 0x806A4F6: execute_command_internal (in /bin/bash) ==11765== ==11765== LEAK SUMMARY: ==11765== definitely lost: 27 bytes in 1 blocks. ==11765== possibly lost: 0 bytes in 0 blocks. ==11765== still reachable: 24,781 bytes in 1,108 blocks. ==11765== suppressed: 0 bytes in 0 blocks. ==11765== Reachable blocks (those to which a pointer was found) are not shown. ==11765== To see them, rerun with: --show-reachable=yes ==11764== ==11764== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 16 from 1) ==11764== malloc/free: in use at exit: 24,274 bytes in 1,085 blocks. ==11764== malloc/free: 2,792 allocs, 1,707 frees, 105,672 bytes allocated. ==11764== For counts of detected errors, rerun with: -v ==11764== searching for pointers to 1,085 not-freed blocks. ==11764== checked 128,544 bytes. ==11764== ==11764== LEAK SUMMARY: ==11764== definitely lost: 0 bytes in 0 blocks. ==11764== possibly lost: 0 bytes in 0 blocks. ==11764== still reachable: 24,274 bytes in 1,085 blocks. ==11764== suppressed: 0 bytes in 0 blocks. ==11764== Reachable blocks (those to which a pointer was found) are not shown. ==11764== To see them, rerun with: --show-reachable=yes ==11767== ==11767== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 16 from 1) ==11767== malloc/free: in use at exit: 24,716 bytes in 1,104 blocks. ==11767== malloc/free: 2,868 allocs, 1,764 frees, 107,574 bytes allocated. ==11767== For counts of detected errors, rerun with: -v ==11767== searching for pointers to 1,104 not-freed blocks. ==11767== checked 129,208 bytes. ==11767== ==11767== 15 bytes in 1 blocks are definitely lost in loss record 1 of 4 ==11767== at 0x401B46D: malloc (vg_replace_malloc.c:149) ==11767== by 0x80958E1: xmalloc (in /bin/bash) ==11767== by 0x806AF94: execute_command_internal (in /bin/bash) ==11767== by 0x806DC83: (within /bin/bash) ==11767== by 0x806A1F4: execute_command_internal (in /bin/bash) ==11767== by 0x8099EBB: parse_and_execute (in /bin/bash) ==11767== by 0x807E28A: command_substitute (in /bin/bash) ==11767== by 0x8081F74: (within /bin/bash) ==11767== by 0x8082634: (within /bin/bash) ==11767== by 0x8082EF0: (within /bin/bash) ==11767== by 0x8082F3C: expand_string_unsplit (in /bin/bash) ==11767== by 0x807A974: (within /bin/bash) ==11767== ==11767== LEAK SUMMARY: ==11767== definitely lost: 15 bytes in 1 blocks. ==11767== possibly lost: 0 bytes in 0 blocks. ==11767== still reachable: 24,701 bytes in 1,103 blocks. ==11767== suppressed: 0 bytes in 0 blocks. ==11767== Reachable blocks (those to which a pointer was found) are not shown. ==11767== To see them, rerun with: --show-reachable=yes ==11766== ==11766== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 16 from 1) ==11766== malloc/free: in use at exit: 23,959 bytes in 1,069 blocks. ==11766== malloc/free: 2,857 allocs, 1,788 frees, 107,204 bytes allocated. ==11766== For counts of detected errors, rerun with: -v ==11766== searching for pointers to 1,069 not-freed blocks. ==11766== checked 128,048 bytes. ==11766== ==11766== LEAK SUMMARY: ==11766== definitely lost: 0 bytes in 0 blocks. ==11766== possibly lost: 0 bytes in 0 blocks. ==11766== still reachable: 23,959 bytes in 1,069 blocks. ==11766== suppressed: 0 bytes in 0 blocks. ==11766== Reachable blocks (those to which a pointer was found) are not shown. ==11766== To see them, rerun with: --show-reachable=yes ==11769== ==11769== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 16 from 1) ==11769== malloc/free: in use at exit: 23,879 bytes in 1,067 blocks. ==11769== malloc/free: 2,929 allocs, 1,862 frees, 108,962 bytes allocated. ==11769== For counts of detected errors, rerun with: -v ==11769== searching for pointers to 1,067 not-freed blocks. ==11769== checked 127,784 bytes. ==11769== ==11769== LEAK SUMMARY: ==11769== definitely lost: 0 bytes in 0 blocks. ==11769== possibly lost: 0 bytes in 0 blocks. ==11769== still reachable: 23,879 bytes in 1,067 blocks. ==11769== suppressed: 0 bytes in 0 blocks. ==11769== Reachable blocks (those to which a pointer was found) are not shown. ==11769== To see them, rerun with: --show-reachable=yes ==11772== ==11772== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 16 from 1) ==11772== malloc/free: in use at exit: 23,522 bytes in 1,053 blocks. ==11772== malloc/free: 2,996 allocs, 1,943 frees, 110,348 bytes allocated. ==11772== For counts of detected errors, rerun with: -v ==11772== searching for pointers to 1,053 not-freed blocks. ==11772== checked 127,204 bytes. ==11772== ==11772== 25 bytes in 1 blocks are definitely lost in loss record 1 of 4 ==11772== at 0x401B46D: malloc (vg_replace_malloc.c:149) ==11772== by 0x80958E1: xmalloc (in /bin/bash) ==11772== by 0x80A6B38: sh_canonpath (in /bin/bash) ==11772== by 0x80969FC: (within /bin/bash) ==11772== by 0x8096BCE: cd_builtin (in /bin/bash) ==11772== by 0x806924D: (within /bin/bash) ==11772== by 0x806AD70: execute_command_internal (in /bin/bash) ==11772== by 0x806C67F: execute_command (in /bin/bash) ==11772== by 0x806DA1E: (within /bin/bash) ==11772== by 0x806A1F4: execute_command_internal (in /bin/bash) ==11772== by 0x8099EBB: parse_and_execute (in /bin/bash) ==11772== by 0x807E28A: command_substitute (in /bin/bash) ==11772== ==11772== LEAK SUMMARY: ==11772== definitely lost: 25 bytes in 1 blocks. ==11772== possibly lost: 0 bytes in 0 blocks. ==11772== still reachable: 23,497 bytes in 1,052 blocks. ==11772== suppressed: 0 bytes in 0 blocks. ==11772== Reachable blocks (those to which a pointer was found) are not shown. ==11772== To see them, rerun with: --show-reachable=yes ==11773== ==11773== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 16 from 1) ==11773== malloc/free: in use at exit: 24,074 bytes in 1,071 blocks. ==11773== malloc/free: 3,159 allocs, 2,088 frees, 115,497 bytes allocated. ==11773== For counts of detected errors, rerun with: -v ==11773== searching for pointers to 1,071 not-freed blocks. ==11773== checked 127,728 bytes. ==11773== ==11773== LEAK SUMMARY: ==11773== definitely lost: 0 bytes in 0 blocks. ==11773== possibly lost: 0 bytes in 0 blocks. ==11773== still reachable: 24,074 bytes in 1,071 blocks. ==11773== suppressed: 0 bytes in 0 blocks. ==11773== Reachable blocks (those to which a pointer was found) are not shown. ==11773== To see them, rerun with: --show-reachable=yes SQLite version 3.3.6 Enter ".help" for instructions sqlite> ___________________________________________________________ 抢注雅虎免费邮箱-3.5G容量,20M附件! http://cn.mail.yahoo.com