使用libxml2时内存泄漏问题
这段时间写的程序使用了libxml2,现在程序基本上完成了,但是使用内存调试工具运行时却发现内存有泄漏的问题!
调试的输出是这样的
==28237==
==28237== HEAP SUMMARY:
==28237== in use at exit: 5,139 bytes in 96 blocks
==28237== total heap usage: 10,310 allocs, 10,214 frees, 656,070 bytes allocated
==28237==
==28237== 15 bytes in 5 blocks are definitely lost in loss record 9 of 46
==28237== at 0x402BE68: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==28237== by 0x414351B: xmlStrndup (in /usr/lib/i386-linux-gnu/libxml2.so.2.7.8)
==28237== by 0x414359D: xmlStrdup (in /usr/lib/i386-linux-gnu/libxml2.so.2.7.8)
==28237==
==28237== LEAK SUMMARY:
==28237== definitely lost: 15 bytes in 5 blocks
==28237== indirectly lost: 0 bytes in 0 blocks
==28237== possibly lost: 0 bytes in 0 blocks
==28237== still reachable: 5,124 bytes in 91 blocks
==28237== suppressed: 0 bytes in 0 blocks
==28237== Reachable blocks (those to which a pointer was found) are not shown.
==28237== To see them, rerun with: --leak-check=full --show-reachable=yes
==28237==
==28237== For counts of detected and suppressed errors, rerun with: -v
==28237== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)