Hello,
Does anyone have any idea why the following simple sample code reports
"32 bytes possibly lost" when run under Valgrind? I'm using DbXml 2.2
and Db 4.4. I've pasted output from "g++ -v", "ldconfig ./test6" and
the valgrind output:
=================== BEGIN SAMPLE CODE ==================
#include <db.h>
#include <db_cxx.h>
#include <dbxml/DbXml.hpp>
int main(int argc, char* argv[]) {
DbEnv * mpEnv;
DbXml::XmlManager * mpManager;
mpEnv = new DbEnv(0);
mpEnv->open("/tmp/bdb_views", 0, 0);
mpManager = new DbXml::XmlManager(mpEnv);
delete mpManager;
mpEnv->close(0);
delete mpEnv;
}
==================== END SAMPLE CODE =====================
===================== BEGIN "g++ -v" ========================
[root@fcdev03 vpf01-memcheck]# g++ -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --disable-libunwind-exceptions --with-system-zlib
--enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7)
====================== END "g++ -v" ==========================
======================= BEGIN "ldd ./test6" =====================
[root@fcdev03 vpf01-memcheck]# ldd ./test6
libdb_cxx-4.4.so => /usr/lib/libdb_cxx-4.4.so (0x00641000)
libdbxml-2.2.so => /usr/lib/libdbxml-2.2.so (0x002ac000)
libxerces-c.so.27 => /usr/lib/libxerces-c.so.27 (0x075ab000)
libxquery-1.2.so => /usr/lib/libxquery-1.2.so (0x0073a000)
libpathan.so.3 => /usr/lib/libpathan.so.3 (0x00a97000)
libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x009da000)
libm.so.6 => /lib/tls/libm.so.6 (0x005f5000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00730000)
libc.so.6 => /lib/tls/libc.so.6 (0x004d1000)
libpthread.so.0 => /lib/tls/libpthread.so.0 (0x0062d000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x004b8000)
========================= END "ldd ./test6" ======================
======================= BEGIN "valgrind --leak-check=full -v ./test6"
=============
[root@fcdev03 vpf01-memcheck]# valgrind --leak-check=full -v ./test6
==16659== Memcheck, a memory error detector.
==16659== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et
al.
==16659== Using LibVEX rev 1575, a library for dynamic binary
translation.
==16659== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
==16659== Using valgrind-3.1.1, a dynamic binary instrumentation
framework.
==16659== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et
al.
==16659==
--16659-- Command line
--16659-- ./test6
--16659-- Startup, with flags:
--16659-- --leak-check=full
--16659-- -v
--16659-- Contents of /proc/version:
--16659-- Linux version 2.6.10-1.9_FC2
(bhcompile (AT) porky (DOT) build.redhat.com) (gcc version 3.3.3 20040412 (Red Hat
Linux 3.3.3-7)) #1 Thu Jan 13 17:54:57 EST 2005
--16659-- Arch and subarch: X86, x86-sse2
--16659-- Valgrind library directory: /usr/local/lib/valgrind
--16659-- Reading syms from /lib/ld-2.3.3.so (0x4B8000)
--16659-- Reading syms from /vmware/vpf01-memcheck/test6 (0x8048000)
--16659-- Reading syms from /usr/local/lib/valgrind/x86-linux/memcheck
(0xB0000000)
--16659-- object doesn't have a dynamic symbol table
--16659-- Reading suppressions file:
/usr/local/lib/valgrind/default.supp
--16659-- REDIR: 0x4C9420 (index) redirected to 0xB001AF3E
(vgPlain_x86_linux_REDIR_FOR_index)
--16659-- Reading syms from
/usr/local/lib/valgrind/x86-linux/vgpreload_core.so (0x4000000)
--16659-- Reading syms from
/usr/local/lib/valgrind/x86-linux/vgpreload_memcheck.so (0x4003000)
--16659-- REDIR: 0x4C95C0 (strlen) redirected to 0x4005F8C (strlen)
--16659-- Reading syms from /usr/lib/libdb_cxx-4.4.so (0x641000)
--16659-- Reading syms from /usr/lib/libdbxml-2.2.so (0x2AC000)
--16659-- Reading syms from /usr/lib/libxerces-c.so.27.0 (0x75AB000)
--16659-- Reading syms from /usr/lib/libxquery-1.2.so (0x73A000)
--16659-- Reading syms from /usr/lib/libpathan.so.3.0.1 (0xA97000)
--16659-- Reading syms from /usr/lib/libstdc++.so.5.0.5 (0x9DA000)
--16659-- object doesn't have a symbol table
--16659-- Reading syms from /lib/tls/libm-2.3.3.so (0x5F5000)
--16659-- Reading syms from /lib/libgcc_s-3.3.3-20040413.so.1
(0x730000)
--16659-- object doesn't have a symbol table
--16659-- Reading syms from /lib/tls/libc-2.3.3.so (0x4D1000)
--16659-- Reading syms from /lib/tls/libpthread-0.61.so (0x62D000)
--16659-- REDIR: 0x4B87A0 (_dl_sysinfo_int80) redirected to 0xB001AF3B
(???)
--16659-- REDIR: 0x538B10 (memset) redirected to 0x4006680 (memset)
--16659-- REDIR: 0x537D70 (rindex) redirected to 0x4005C88 (rindex)
--16659-- REDIR: 0x5374E0 (strcpy) redirected to 0x4005FC4 (strcpy)
--16659-- REDIR: 0x538FE0 (memcpy) redirected to 0x40062A4 (memcpy)
--16659-- REDIR: 0x537AB0 (strnlen) redirected to 0x4005F4C (strnlen)
--16659-- REDIR: 0x537A00 (strlen) redirected to 0x4005F70 (strlen)
--16659-- REDIR: 0xA6D380 (operator new(unsigned)) redirected to
0x4004779 (operator new(unsigned))
--16659-- REDIR: 0x5311D0 (malloc) redirected to 0x40043EE (malloc)
--16659-- REDIR: 0xA6D4C0 (operator new[](unsigned)) redirected to
0x4004BA7 (operator new[](unsigned))
--16659-- REDIR: 0x537CC0 (strncpy) redirected to 0x4006084 (strncpy)
--16659-- REDIR: 0x537300 (index) redirected to 0x4005D3C (index)
--16659-- REDIR: 0x5336A0 (free) redirected to 0x4004EE5 (free)
--16659-- REDIR: 0x538630 (memchr) redirected to 0x4006280 (memchr)
--16659-- REDIR: 0x5398A0 (rawmemchr) redirected to 0x4006714
(rawmemchr)
--16659-- REDIR: 0x538CD0 (stpcpy) redirected to 0x4006440 (stpcpy)
--16659-- REDIR: 0x531350 (realloc) redirected to 0x400574C (realloc)
--16659-- REDIR: 0x538AB0 (memmove) redirected to 0x40066A8 (memmove)
--16659-- REDIR: 0xA6BDB0 (operator delete(void*)) redirected to
0x4005179 (operator delete(void*))
--16659-- REDIR: 0xA6BE10 (operator delete[](void*)) redirected to
0x4005491 (operator delete[](void*))
==16659==
==16659== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 22 from
1)
--16659--
--16659-- supp: 22 Ubuntu-stripped-ld.so
==16659== malloc/free: in use at exit: 285,032 bytes in 50 blocks.
==16659== malloc/free: 792 allocs, 742 frees, 314,543 bytes allocated.
==16659==
==16659== searching for pointers to 50 not-freed blocks.
==16659== checked 1,329,064 bytes.
==16659==
==16659== 32 bytes in 1 blocks are possibly lost in loss record 1 of 2
==16659== at 0x400446D: malloc (vg_replace_malloc.c:149)
==16659== by 0x39C152:
DbXml::SimpleMemoryManager::allocate(unsigned) (Globals.cpp:50)
==16659== by 0x77FDC92: xercesc_2_7::XMemory:

perator new(unsigned,
xercesc_2_7::MemoryManager*) (in /usr/lib/libxerces-c.so.27.0)
==16659== by 0x7772C38:
xercesc_2_7::XMLPlatformUtils::makeMutex(xercesc_2 _7::MemoryManager*)
(in /usr/lib/libxerces-c.so.27.0)
==16659== by 0x39D4D7: DbXml::Globals::initialize(DbEnv*)
(Globals.cpp:61)
==16659== by 0x3A049A: DbXml::Manager::initialize(DbEnv*)
(Manager.cpp:142)
==16659== by 0x39F76C: DbXml::Manager::Manager(DbEnv*, unsigned)
(Manager.cpp:82)
==16659== by 0x399C08: DbXml::XmlManager::XmlManager(DbEnv*,
unsigned) (XmlManager.cpp:49)
==16659== by 0x8048944: main (test6.cpp:10)
==16659==
==16659== LEAK SUMMARY:
==16659== definitely lost: 0 bytes in 0 blocks.
==16659== possibly lost: 32 bytes in 1 blocks.
==16659== still reachable: 285,000 bytes in 49 blocks.
==16659== suppressed: 0 bytes in 0 blocks.
==16659== Reachable blocks (those to which a pointer was found) are not
shown.
==16659== To see them, rerun with: --show-reachable=yes
--16659-- memcheck: sanity checks: 127 cheap, 6 expensive
--16659-- memcheck: auxmaps: 0 auxmap entries (0k, 0M) in use
--16659-- memcheck: auxmaps: 0 searches, 0 comparisons
--16659-- memcheck: secondaries: 41 issued (2624k, 2M)
--16659-- memcheck: secondaries: 176 accessible and distinguished
(11264k, 11M)
--16659-- tt/tc: 21,357 tt lookups requiring 23,439 probes
--16659-- tt/tc: 21,357 fast-cache updates, 3 flushes
--16659-- translate: new 10,395 (219,607 -> 3,754,258; ratio
170:10) [0 scs]
--16659-- translate: dumped 0 (0 -> ??)
--16659-- translate: discarded 8 (187 -> ??)
--16659-- scheduler: 6,392,595 jumps (bb entries).
--16659-- scheduler: 127/12,833 major/minor sched events.
--16659-- sanity: 128 cheap, 6 expensive checks.
--16659-- exectx: 30,011 lists, 1,060 contexts (avg 0 per list)
--16659-- exectx: 1,556 searches, 517 full compares (332 per 1000)
--16659-- exectx: 48 cmp2, 56 cmp4, 0 cmpAll
========================= END VALGRIND OUTPUT==================
Thanks in advance,
Ravi