[Ace-users] [ace-users] ACE_Stream beginner problem

Douglas C. Schmidt schmidt at dre.vanderbilt.edu
Tue Jan 15 11:51:37 CST 2008


Thanks very much for tracking this down further.  Would you be able to
take a look at the place(s) that Valgrind is complaining about the
leaks and see if you can pinpoint the offending call to new that isn't
matched with a call to delete?!

Thanks,

doug

>I ave the same problem with 5.6.2, this is the valgrind result:
>
>==29868== Memcheck, a memory error detector.
>==29868== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et
>al.
>==29868== Using LibVEX rev 1804, a library for dynamic binary
>translation.
>==29868== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
>==29868== Using valgrind-3.3.0, a dynamic binary instrumentation
>framework.
>==29868== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et
>al.
>==29868==
>--29868-- Command line
>--29868--    ./cmstream
>--29868-- Startup, with flags:
>--29868--    -v
>--29868--    --leak-check=full
>--29868--    --show-reachable=yes
>--29868-- Contents of /proc/version:
>--29868--   Linux version 2.4.30-ow1 (root at darkstar) (gcc version
>3.2.3) #5 Thu Mar 16 21:37:00 CET 2006
>--29868-- Arch and hwcaps: X86, x86-sse1-sse2
>--29868-- Page sizes: currently 4096, max supported 4096
>--29868-- Valgrind library directory: /usr/local/lib/valgrind
>--29868-- Reading syms from /lib/ld-2.3.2.so (0x4000000)
>--29868-- Reading syms from /sviluppo/linux/leiconsqd/server/cmstream
>(0x8048000)
>--29868-- Reading syms from /usr/local/lib/valgrind/x86-linux/memcheck
>(0x38000000)
>--29868--    object doesn't have a dynamic symbol table
>--29868-- Reading suppressions file: /usr/local/lib/valgrind/
>default.supp
>--29868-- REDIR: 0x4010390 (index) redirected to 0x38025973
>(vgPlain_x86_linux_REDIR_FOR_index)
>--29868-- Reading syms from /usr/local/lib/valgrind/x86-linux/
>vgpreload_core.so (0x4016000)
>--29868-- Reading syms from /usr/local/lib/valgrind/x86-linux/
>vgpreload_memcheck.so (0x4019000)
>==29868== WARNING: new redirection conflicts with existing -- ignoring
>it
>--29868--     new: 0x04010390 (index               ) R-> 0x0401cb30
>index
>--29868-- REDIR: 0x4010540 (strlen) redirected to 0x401cda0 (strlen)
>--29868-- Reading syms from /usr/local/lib/libACE-5.6.2.so (0x4025000)
>--29868-- Reading syms from /usr/lib/libstdc++.so.5.0.3 (0x41A6000)
>--29868--    object doesn't have a symbol table
>--29868-- Reading syms from /lib/libm-2.3.2.so (0x4257000)
>--29868-- Reading syms from /usr/lib/libgcc_s.so.1 (0x427A000)
>--29868--    object doesn't have a symbol table
>--29868-- Reading syms from /lib/libpthread-0.10.so (0x4282000)
>--29868-- Reading syms from /lib/libc-2.3.2.so (0x42D4000)
>--29868-- Reading syms from /lib/librt-2.3.2.so (0x440A000)
>--29868-- Reading syms from /lib/libdl-2.3.2.so (0x441C000)
>--29868-- REDIR: 0x43516f0 (memset) redirected to 0x401d8a0 (memset)
>--29868-- REDIR: 0x4350160 (rindex) redirected to 0x401c9f0 (rindex)
>--29868-- REDIR: 0x434f590 (strcpy) redirected to 0x401cde0 (strcpy)
>--29868-- REDIR: 0x422eb80 (operator new(unsigned, std::nothrow_t
>const&)) redirected to 0x401afc0 (operator new(unsigned,
>std::nothrow_t const&))
>--29868-- REDIR: 0x434ae70 (malloc) redirected to 0x401a8e0 (malloc)
>--29868-- REDIR: 0x43514a0 (memchr) redirected to 0x401d120 (memchr)
>--29868-- REDIR: 0x4351d60 (memcpy) redirected to 0x401d150 (memcpy)
>--29868-- REDIR: 0x434e8e0 (index) redirected to 0x401cb00 (index)
>--29868-- REDIR: 0x434fe20 (strlen) redirected to 0x401cd80 (strlen)
>--29868-- REDIR: 0x434b040 (free) redirected to 0x401b7f0 (free)
>--29868-- REDIR: 0x43518e0 (stpcpy) redirected to 0x401d630 (stpcpy)
>--29868-- REDIR: 0x422ec70 (operator new[](unsigned, std::nothrow_t
>const&)) redirected to 0x401b580 (operator new[](unsigned,
>std::nothrow_t const&))
>--29868-- REDIR: 0x434b6a0 (calloc) redirected to 0x401c240 (calloc)
>--29868-- REDIR: 0x434ff80 (strncat) redirected to 0x401cc60 (strncat)
>--29868-- REDIR: 0x4351750 (mempcpy) redirected to 0x401db20 (mempcpy)
>(29868|16384) ---------------------------------------- start test 0
>--29868-- REDIR: 0x422d620 (operator delete[](void*)) redirected to
>0x401bf80 (operator delete[](void*))
>--29868-- REDIR: 0x422eab0 (operator new(unsigned)) redirected to
>0x401adc0 (operator new(unsigned))
>(29868|16384) stream->open(NULL) retVal == 0
>--29868-- REDIR: 0x422d5c0 (operator delete(void*)) redirected to
>0x401bb60 (operator delete(void*))
>(29868|16384) stream->close() retVal == 0
>(29868|16384) ----------------------------------------  end test 0
>==29868== Invalid free() / delete / delete[]
>==29868==    at 0x401B859: free (vg_replace_malloc.c:323)
>==29868==    by 0x43E8A5B: free_mem (in /lib/libc-2.3.2.so)
>==29868==    by 0x43E87C8: __libc_freeres (in /lib/libc-2.3.2.so)
>==29868==    by 0x40164A0: _vgnU_freeres (vg_preloaded.c:60)
>==29868==    by 0x430024F: exit (in /lib/libc-2.3.2.so)
>==29868==    by 0x42E9D0D: (below main) (in /lib/libc-2.3.2.so)
>==29868==  Address 0x42d3270 is not stack'd, malloc'd or (recently)
>free'd
>==29868==
>==29868== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 25 from
>1)
>==29868==
>==29868== 1 errors in context 1 of 1:
>==29868== Invalid free() / delete / delete[]
>==29868==    at 0x401B859: free (vg_replace_malloc.c:323)
>==29868==    by 0x43E8A5B: free_mem (in /lib/libc-2.3.2.so)
>==29868==    by 0x43E87C8: __libc_freeres (in /lib/libc-2.3.2.so)
>==29868==    by 0x40164A0: _vgnU_freeres (vg_preloaded.c:60)
>==29868==    by 0x430024F: exit (in /lib/libc-2.3.2.so)
>==29868==    by 0x42E9D0D: (below main) (in /lib/libc-2.3.2.so)
>==29868==  Address 0x42d3270 is not stack'd, malloc'd or (recently)
>free'd
>--29868--
>--29868-- supp:     25 Ubuntu-stripped-ld.so
>==29868==
>==29868== IN SUMMARY: 1 errors from 1 contexts (suppressed: 25 from 1)
>==29868==
>==29868== malloc/free: in use at exit: 17,729 bytes in 13 blocks.
>==29868== malloc/free: 69 allocs, 57 frees, 67,503 bytes allocated.
>==29868==
>==29868== searching for pointers to 13 not-freed blocks.
>==29868== checked 748,080 bytes.
>==29868==
>==29868==
>==29868== 92 bytes in 1 blocks are still reachable in loss record 1 of
>10
>==29868==    at 0x401B02D: operator new(unsigned, std::nothrow_t
>const&) (vg_replace_malloc.c:244)
>==29868==    by 0x804DF67: ACE_Stream<ACE_MT_SYNCH>::open(void*,
>ACE_Module<ACE_MT_SYNCH>*, ACE_Module<ACE_MT_SYNCH>*) (in /sviluppo/
>linux/leiconsqd/server/cm
>stream)
>==29868==    by 0x804DAC0: ACE_Stream<ACE_MT_SYNCH>::ACE_Stream(void*,
>ACE_Module<ACE_MT_SYNCH>*, ACE_Module<ACE_MT_SYNCH>*) (in /sviluppo/
>linux/leiconsqd/ser
>ver/cmstream)
>==29868==    by 0x804D8E0: main (in /sviluppo/linux/leiconsqd/server/
>cmstream)
>==29868==
>==29868==
>==29868== 92 bytes in 1 blocks are still reachable in loss record 2 of
>10
>==29868==    at 0x401B02D: operator new(unsigned, std::nothrow_t
>const&) (vg_replace_malloc.c:244)
>==29868==    by 0x804DE93: ACE_Stream<ACE_MT_SYNCH>::open(void*,
>ACE_Module<ACE_MT_SYNCH>*, ACE_Module<ACE_MT_SYNCH>*) (in /sviluppo/
>linux/leiconsqd/server/cm
>stream)
>==29868==    by 0x804DAC0: ACE_Stream<ACE_MT_SYNCH>::ACE_Stream(void*,
>ACE_Module<ACE_MT_SYNCH>*, ACE_Module<ACE_MT_SYNCH>*) (in /sviluppo/
>linux/leiconsqd/ser
>ver/cmstream)
>==29868==    by 0x804D8E0: main (in /sviluppo/linux/leiconsqd/server/
>cmstream)
>==29868==
>==29868==
>==29868== 92 bytes in 1 blocks are still reachable in loss record 3 of
>10
>==29868==    at 0x401B02D: operator new(unsigned, std::nothrow_t
>const&) (vg_replace_malloc.c:244)
>==29868==    by 0x804DCD4: ACE_Stream<ACE_MT_SYNCH>::open(void*,
>ACE_Module<ACE_MT_SYNCH>*, ACE_Module<ACE_MT_SYNCH>*) (in /sviluppo/
>linux/leiconsqd/server/cm
>stream)
>==29868==    by 0x804DAC0: ACE_Stream<ACE_MT_SYNCH>::ACE_Stream(void*,
>ACE_Module<ACE_MT_SYNCH>*, ACE_Module<ACE_MT_SYNCH>*) (in /sviluppo/
>linux/leiconsqd/ser
>ver/cmstream)
>==29868==    by 0x804D8E0: main (in /sviluppo/linux/leiconsqd/server/
>cmstream)
>==29868==
>==29868==
>==29868== 92 bytes in 1 blocks are still reachable in loss record 4 of
>10
>==29868==    at 0x401B02D: operator new(unsigned, std::nothrow_t
>const&) (vg_replace_malloc.c:244)
>==29868==    by 0x804DC03: ACE_Stream<ACE_MT_SYNCH>::open(void*,
>ACE_Module<ACE_MT_SYNCH>*, ACE_Module<ACE_MT_SYNCH>*) (in /sviluppo/
>linux/leiconsqd/server/cm
>stream)
>==29868==    by 0x804DAC0: ACE_Stream<ACE_MT_SYNCH>::ACE_Stream(void*,
>ACE_Module<ACE_MT_SYNCH>*, ACE_Module<ACE_MT_SYNCH>*) (in /sviluppo/
>linux/leiconsqd/ser
>ver/cmstream)
>==29868==    by 0x804D8E0: main (in /sviluppo/linux/leiconsqd/server/
>cmstream)
>==29868==
>==29868==
>==29868== 128 bytes in 1 blocks are still reachable in loss record 5
>of 10
>==29868==    at 0x401C2AD: calloc (vg_replace_malloc.c:397)
>==29868==    by 0x428B053: pthread_setspecific (in /lib/
>libpthread-0.10.so)
>==29868==    by 0x4108250: ACE_OS::thr_setspecific(unsigned, void*)
>(OS_NS_Thread.cpp:4914)
>==29868==    by 0x413CE5C:
>ACE_TSS<ACE_Service_Gestalt>::ts_object(ACE_Service_Gestalt*)
>(Thread.inl:40)
>==29868==    by 0x413D2E7: ACE_Unmanaged_Singleton<ACE_Service_Config,
>ACE_Recursive_Thread_Mutex>::instance() (Service_Config.cpp:387)
>==29868==    by 0x413C2E5: ACE_Service_Config::static_svcs()
>(Service_Config.cpp:334)
>==29868==    by 0x410A9F2: ACE_Object_Manager::init()
>(Object_Manager.cpp:133)
>==29868==    by 0x410B3B6: ACE_Object_Manager::ACE_Object_Manager()
>(Object_Manager.cpp:343)
>==29868==    by 0x410B644: ACE_Object_Manager::instance()
>(Object_Manager.cpp:370)
>==29868==    by 0x410A755:
>__static_initialization_and_destruction_0(int, int)
>(Object_Manager.cpp:788)
>==29868==    by 0x410C961:
>_GLOBAL__I__ZN18ACE_Object_Manager9instance_E (Truncate.h:385)
>==29868==    by 0x41603B4: (within /usr/local/lib/libACE-5.6.2.so)
>==29868==
>==29868==
>==29868== 720 bytes in 4 blocks are still reachable in loss record 6
>of 10
>==29868==    at 0x401B02D: operator new(unsigned, std::nothrow_t
>const&) (vg_replace_malloc.c:244)
>==29868==    by 0x804E602:
>ACE_Task<ACE_MT_SYNCH>::ACE_Task(ACE_Thread_Manager*,
>ACE_Message_Queue<ACE_MT_SYNCH>*) (in /sviluppo/linux/leiconsqd/server/
>cmstre
>am)
>==29868==    by 0x804E370:
>ACE_Stream_Head<ACE_MT_SYNCH>::ACE_Stream_Head() (in /sviluppo/linux/
>leiconsqd/server/cmstream)
>==29868==    by 0x804DC2B: ACE_Stream<ACE_MT_SYNCH>::open(void*,
>ACE_Module<ACE_MT_SYNCH>*, ACE_Module<ACE_MT_SYNCH>*) (in /sviluppo/
>linux/leiconsqd/server/cm
>stream)
>==29868==    by 0x804DAC0: ACE_Stream<ACE_MT_SYNCH>::ACE_Stream(void*,
>ACE_Module<ACE_MT_SYNCH>*, ACE_Module<ACE_MT_SYNCH>*) (in /sviluppo/
>linux/leiconsqd/ser
>ver/cmstream)
>==29868==    by 0x804D8E0: main (in /sviluppo/linux/leiconsqd/server/
>cmstream)
>==29868==
>==29868==
>==29868== 4,097 bytes in 1 blocks are still reachable in loss record 7
>of 10
>==29868==    at 0x401B5ED: operator new[](unsigned, std::nothrow_t
>const&) (vg_replace_malloc.c:288)
>==29868==    by 0x40E962F: ACE_Log_Msg::ACE_Log_Msg() (Log_Msg.cpp:
>696)
>==29868==    by 0x40E8E91: ACE_Log_Msg::instance() (Thread.inl:40)
>==29868==    by 0x410A987: ACE_Object_Manager::init()
>(Object_Manager.cpp:266)
>==29868==    by 0x410B3B6: ACE_Object_Manager::ACE_Object_Manager()
>(Object_Manager.cpp:343)
>==29868==    by 0x410B644: ACE_Object_Manager::instance()
>(Object_Manager.cpp:370)
>==29868==    by 0x410A755:
>__static_initialization_and_destruction_0(int, int)
>(Object_Manager.cpp:788)
>==29868==    by 0x410C961:
>_GLOBAL__I__ZN18ACE_Object_Manager9instance_E (Truncate.h:385)
>==29868==    by 0x41603B4: (within /usr/local/lib/libACE-5.6.2.so)
>==29868==    by 0x409F87C: (within /usr/local/lib/libACE-5.6.2.so)
>==29868==    by 0x400AF3D: call_init (dl-init.c:68)
>==29868==    by 0x400B035: _dl_init (dl-init.c:140)
>==29868==
>==29868==
>==29868== 4,124 bytes in 1 blocks are still reachable in loss record 8
>of 10
>==29868==    at 0x401B02D: operator new(unsigned, std::nothrow_t
>const&) (vg_replace_malloc.c:244)
>==29868==    by 0x804E077: ACE_Stream<ACE_MT_SYNCH>::open(void*,
>ACE_Module<ACE_MT_SYNCH>*, ACE_Module<ACE_MT_SYNCH>*) (in /sviluppo/
>linux/leiconsqd/server/cm
>stream)
>==29868==    by 0x804DAC0: ACE_Stream<ACE_MT_SYNCH>::ACE_Stream(void*,
>ACE_Module<ACE_MT_SYNCH>*, ACE_Module<ACE_MT_SYNCH>*) (in /sviluppo/
>linux/leiconsqd/ser
>ver/cmstream)
>==29868==    by 0x804D8E0: main (in /sviluppo/linux/leiconsqd/server/
>cmstream)
>==29868==
>==29868==
>==29868== 4,124 bytes in 1 blocks are still reachable in loss record 9
>of 10
>==29868==    at 0x401B02D: operator new(unsigned, std::nothrow_t
>const&) (vg_replace_malloc.c:244)
>==29868==    by 0x804DDA8: ACE_Stream<ACE_MT_SYNCH>::open(void*,
>ACE_Module<ACE_MT_SYNCH>*, ACE_Module<ACE_MT_SYNCH>*) (in /sviluppo/
>linux/leiconsqd/server/cm
>stream)
>==29868==    by 0x804DAC0: ACE_Stream<ACE_MT_SYNCH>::ACE_Stream(void*,
>ACE_Module<ACE_MT_SYNCH>*, ACE_Module<ACE_MT_SYNCH>*) (in /sviluppo/
>linux/leiconsqd/ser
>ver/cmstream)
>==29868==    by 0x804D8E0: main (in /sviluppo/linux/leiconsqd/server/
>cmstream)
>==29868==
>==29868==
>==29868== 4,168 bytes in 1 blocks are still reachable in loss record
>10 of 10
>==29868==    at 0x401B02D: operator new(unsigned, std::nothrow_t
>const&) (vg_replace_malloc.c:244)
>==29868==    by 0x40E8E22: ACE_Log_Msg::instance() (Log_Msg.cpp:371)
>==29868==    by 0x410A987: ACE_Object_Manager::init()
>(Object_Manager.cpp:266)
>==29868==    by 0x410B3B6: ACE_Object_Manager::ACE_Object_Manager()
>(Object_Manager.cpp:343)
>==29868==    by 0x410B644: ACE_Object_Manager::instance()
>(Object_Manager.cpp:370)
>==29868==    by 0x410A755:
>__static_initialization_and_destruction_0(int, int)
>(Object_Manager.cpp:788)
>==29868==    by 0x410C961:
>_GLOBAL__I__ZN18ACE_Object_Manager9instance_E (Truncate.h:385)
>==29868==    by 0x41603B4: (within /usr/local/lib/libACE-5.6.2.so)
>==29868==    by 0x409F87C: (within /usr/local/lib/libACE-5.6.2.so)
>==29868==    by 0x400AF3D: call_init (dl-init.c:68)
>==29868==    by 0x400B035: _dl_init (dl-init.c:140)
>==29868==    by 0x4000BEC: (within /lib/ld-2.3.2.so)
>==29868==
>==29868== LEAK SUMMARY:
>==29868==    definitely lost: 0 bytes in 0 blocks.
>==29868==      possibly lost: 0 bytes in 0 blocks.
>==29868==    still reachable: 17,729 bytes in 13 blocks.
>==29868==         suppressed: 0 bytes in 0 blocks.
>--29868--  memcheck: sanity checks: 7 cheap, 2 expensive
>--29868--  memcheck: auxmaps: 0 auxmap entries (0k, 0M) in use
>--29868--  memcheck: auxmaps_L1: 0 searches, 0 cmps, ratio 0:10
>--29868--  memcheck: auxmaps_L2: 0 searches, 0 nodes
>--29868--  memcheck: SMs: n_issued      = 19 (304k, 0M)
>--29868--  memcheck: SMs: n_deissued    = 0 (0k, 0M)
>--29868--  memcheck: SMs: max_noaccess  = 65535 (1048560k, 1023M)
>--29868--  memcheck: SMs: max_undefined = 0 (0k, 0M)
>--29868--  memcheck: SMs: max_defined   = 57 (912k, 0M)
>--29868--  memcheck: SMs: max_non_DSM   = 19 (304k, 0M)
>--29868--  memcheck: max sec V bit nodes:    0 (0k, 0M)
>--29868--  memcheck: set_sec_vbits8 calls: 0 (new: 0, updates: 0)
>--29868--  memcheck: max shadow mem size:   608k, 0M
>--29868-- translate:            fast SP updates identified: 8,386
>( 90.9%)
>--29868-- translate:   generic_known SP updates identified: 341
>(  3.6%)
>--29868-- translate: generic_unknown SP updates identified: 492
>(  5.3%)
>--29868--     tt/tc: 10,415 tt lookups requiring 10,795 probes
>--29868--     tt/tc: 10,415 fast-cache updates, 3 flushes
>--29868--  transtab: new        4,997 (101,475 -> 1,536,366; ratio
>151:10) [0 scs]
>--29868--  transtab: dumped     0 (0 -> ??)
>--29868--  transtab: discarded  6 (144 -> ??)
>--29868-- scheduler: 739,137 jumps (bb entries).
>--29868-- scheduler: 7/5,705 major/minor sched events.
>--29868--    sanity: 8 cheap, 2 expensive checks.
>--29868--    exectx: 769 lists, 131 contexts (avg 0 per list)
>--29868--    exectx: 151 searches, 30 full compares (198 per 1000)
>--29868--    exectx: 56 cmp2, 54 cmp4, 0 cmpAll
>--29868--  errormgr: 17 supplist searches, 679 comparisons during
>search
>--29868--  errormgr: 26 errlist searches, 60 comparisons during search
>
>
>Roberto


-- 
Dr. Douglas C. Schmidt                       Professor and Associate Chair
Electrical Engineering and Computer Science  TEL: (615) 343-8197
Vanderbilt University                        WEB: www.dre.vanderbilt.edu/~schmidt
Nashville, TN 37203                          NET: d.schmidt at vanderbilt.edu



More information about the Ace-users mailing list