Bugzilla – Bug 589
UdpSocketImpl unit test is leaking
Last modified: 2009-06-18 06:33:52 UTC
from ./waf --check --valgrind on ns-regression [702/726] run-unit-test(UdpSocketImpl) ==25193== Memcheck, a memory error detector. ==25193== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al. ==25193== Using LibVEX rev 1804, a library for dynamic binary translation. ==25193== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP. ==25193== Using valgrind-3.3.0-Debian, a dynamic binary instrumentation framework. ==25193== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al. ==25193== For more details, rerun with: -v ==25193== ==25193== Invalid write of size 8 ==25193== at 0x5321F80: __gnu_cxx::new_allocator<ns3::BufferData*>::construct(ns3::BufferData**, ns3::BufferData* const&) (new_allocator.h:107) ==25193== by 0x5322E26: std::vector<ns3::BufferData*, std::allocator<ns3::BufferData*> >::push_back(ns3::BufferData* const&) (stl_vector.h:601) ==25193== by 0x531BB82: ns3::Buffer::Recycle(ns3::BufferData*) (buffer.cc:164) ==25193== by 0x531BDA0: ns3::Buffer::~Buffer() (buffer.cc:311) ==25193== by 0x5352C40: ns3::Packet::~Packet() (packet.h:202) ==25193== by 0x53482ED: ns3::Packet::Unref() const (packet.cc:123) ==25193== by 0x5343341: ns3::Ptr<ns3::Packet>::~Ptr() (ptr.h:432) ==25193== by 0x53DCFAA: ns3::UdpSocketImplTest::~UdpSocketImplTest() (udp-test.cc:80) ==25193== by 0x53D31CF: __tcf_1 (udp-test.cc:262) ==25193== by 0x8ED944F: __cxa_finalize (in /lib/libc-2.7.so) ==25193== by 0x522AF52: (within /home/tomh/hg/jun09/ns-3-allinone/ns-3-dev/build/debug/libns3.so) ==25193== by 0x5684C50: (within /home/tomh/hg/jun09/ns-3-allinone/ns-3-dev/build/debug/libns3.so) ==25193== Address 0xc38df18 is 40 bytes inside a block of size 64 free'd ==25193== at 0x4C227BC: operator delete(void*) (vg_replace_malloc.c:342) ==25193== by 0x53223DC: __gnu_cxx::new_allocator<ns3::BufferData*>::deallocate(ns3::BufferData**, unsigned long) (new_allocator.h:97) ==25193== by 0x532240E: std::_Vector_base<ns3::BufferData*, std::allocator<ns3::BufferData*> >::_M_deallocate(ns3::BufferData**, unsigned long) (stl_vector.h:134) ==25193== by 0x532244F: std::_Vector_base<ns3::BufferData*, std::allocator<ns3::BufferData*> >::~_Vector_base() (stl_vector.h:120) ==25193== by 0x53224A6: std::vector<ns3::BufferData*, std::allocator<ns3::BufferData*> >::~vector() (stl_vector.h:268) ==25193== by 0x531C6CD: ns3::BufferDataList::~BufferDataList() (buffer.cc:125) ==25193== by 0x531C715: __tcf_1 (buffer.cc:96) ==25193== by 0x8ED944F: __cxa_finalize (in /lib/libc-2.7.so) ==25193== by 0x522AF52: (within /home/tomh/hg/jun09/ns-3-allinone/ns-3-dev/build/debug/libns3.so) ==25193== by 0x5684C50: (within /home/tomh/hg/jun09/ns-3-allinone/ns-3-dev/build/debug/libns3.so) ==25193== by 0x8ED910F: exit (in /lib/libc-2.7.so) ==25193== by 0x8EC21CA: (below main) (in /lib/libc-2.7.so) ==25193== ==25193== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 8 from 1) ==25193== malloc/free: in use at exit: 47 bytes in 1 blocks. ==25193== malloc/free: 4,380 allocs, 4,379 frees, 271,967 bytes allocated. ==25193== For counts of detected errors, rerun with: -v ==25193== searching for pointers to 1 not-freed blocks. ==25193== checked 998,888 bytes. ==25193== ==25193== ==25193== 47 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==25193== at 0x4C23487: operator new[](unsigned long) (vg_replace_malloc.c:274) ==25193== by 0x531C85D: ns3::BufferAllocate(unsigned) (buffer.cc:136) ==25193== by 0x531C91A: ns3::Buffer::Create(unsigned) (buffer.cc:185) ==25193== by 0x531D552: ns3::Buffer::AddAtStart(unsigned) (buffer.cc:370) ==25193== by 0x534B7CF: ns3::Packet::AddHeader(ns3::Header const&) (packet.cc:224) ==25193== by 0x53E9B5E: ns3::Ipv4L3Protocol::Send(ns3::Ptr<ns3::Packet>, ns3::Ipv4Address, ns3::Ipv4Address, unsigned char, ns3::Ptr<ns3::Ipv4Route>) (ipv4-l3-protocol.cc:537) ==25193== by 0x5405DD0: ns3::UdpL4Protocol::Send(ns3::Ptr<ns3::Packet>, ns3::Ipv4Address, ns3::Ipv4Address, unsigned short, unsigned short) (udp-l4-protocol.cc:263) ==25193== by 0x542EA41: ns3::UdpSocketImpl::DoSendTo(ns3::Ptr<ns3::Packet>, ns3::Ipv4Address, unsigned short) (udp-socket-impl.cc:387) ==25193== by 0x542F571: ns3::UdpSocketImpl::SendTo(ns3::Ptr<ns3::Packet>, unsigned, ns3::Address const&) (udp-socket-impl.cc:449) ==25193== by 0x53DC645: ns3::UdpSocketImplTest::RunTests() (udp-test.cc:248) ==25193== by 0x5257B16: ns3::TestManager::RealRunTest(std::string) (test.cc:133) ==25193== by 0x5257F74: ns3::TestManager::RunTest(std::string) (test.cc:113) ==25193== ==25193== LEAK SUMMARY: ==25193== definitely lost: 47 bytes in 1 blocks. ==25193== possibly lost: 0 bytes in 0 blocks. ==25193== still reachable: 0 bytes in 0 blocks. ==25193== suppressed: 0 bytes in 0 blocks.
this breaks regression tests in valgrind mode.
must fix asap
changeset: 4551:2081e0f6709d