Bug 527

Summary: PointToPointNetDevice::~PointToPointNetDevice never called
Product: ns-3 Reporter: Mathieu Lacage <mathieu.lacage>
Component: internetAssignee: ns-bugs <ns-bugs>
Status: RESOLVED INVALID    
Severity: normal CC: craigdo
Priority: P5    
Version: pre-release   
Hardware: All   
OS: All   

Description Mathieu Lacage 2009-03-23 06:38:04 UTC
I tried running simple-point-to-point-olsr

There are a couple of ref cycles here and there...
Comment 1 Mathieu Lacage 2009-03-23 08:40:40 UTC
Running this code in valgrind shows:
[mlacage@diese ns-3-dev]$ valgrind ./build/debug/examples/simple-point-to-point-olsr 
==1695== Invalid free() / delete / delete[]
==1695==    at 0x40052EA: operator delete(void*, std::nothrow_t const&) (vg_replace_malloc.c:354)
==1695==    by 0x155058: std::__verify_grouping(char const*, unsigned, std::string const&) (locale_facets.cc:108)
==1695==    by 0x155F8C: std::locale::_Impl::_Impl(char const*, unsigned) (localename.cc:218)
==1695==    by 0x97C5EF: pthread_once (pthread_once.S:122)
==1695==    by 0x157137: std::locale::locale() (localename.cc:88)
==1695==    by 0x15211C: std::locale::_Impl::_Impl(std::locale::_Impl const&, unsigned) (locale.cc:251)
==1695==    by 0x475477D: __static_initialization_and_destruction_0(int, int) (iostream:77)
==1695==    by 0x47547E7: _GLOBAL__I_v4ping.cc (v4ping.cc:180)
==1695==    by 0x475740C: (within /home/mlacage/code/ns-3-dev/build/debug/libns3.so)
==1695==    by 0x429E203: (within /home/mlacage/code/ns-3-dev/build/debug/libns3.so)
==1695==    by 0x7B01EC: _dl_init (dl-init.c:70)
==1695==    by 0x7A088E: (within /lib/ld-2.9.so)
==1695==  Address 0x1ee188 is not stack'd, malloc'd or (recently) free'd


==1695== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 56 from 1)
==1695== malloc/free: in use at exit: 0 bytes in 0 blocks.
==1695== malloc/free: 56,472 allocs, 56,473 frees, 2,130,473 bytes allocated.
==1695== For counts of detected errors, rerun with: -v
==1695== All heap blocks were freed -- no leaks are possible.



which does not look very good. *sigh*

[mlacage@diese ns-3-dev]$ valgrind --version
valgrind-3.3.0
Comment 2 Mathieu Lacage 2009-03-23 09:07:21 UTC
erm, I can't reproduce this with ns-3-dev: it appears that I screwed up something.
Comment 3 Craig Dowell 2009-03-23 12:23:48 UTC
What is oyour environment?  I cannot reproduce this problem:

./waf --run simple-point-to-point-olsr --valgrind > out 2>&1

[ ... ]

PointToPointNetDevice:DoDispose()
PointToPointNetDevice:DoDispose()
PointToPointNetDevice:DoDispose()
PointToPointNetDevice:DoDispose()
PointToPointNetDevice:DoDispose()
PointToPointNetDevice:DoDispose()
PointToPointNetDevice:DoDispose()
PointToPointNetDevice:DoDispose()
PointToPointNetDevice:~PointToPointNetDevice()
0s PointToPointNetDevice:~PointToPointNetDevice()
0s PointToPointNetDevice:~PointToPointNetDevice()
0s PointToPointNetDevice:~PointToPointNetDevice()
0s PointToPointNetDevice:~PointToPointNetDevice()
0s PointToPointNetDevice:~PointToPointNetDevice()
0s PointToPointNetDevice:~PointToPointNetDevice()
0s PointToPointNetDevice:~PointToPointNetDevice()
==6841==
==6841== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 7 from 1)
==6841== malloc/free: in use at exit: 0 bytes in 0 blocks.
==6841== malloc/free: 87,769 allocs, 87,769 frees, 4,219,332 bytes allocated.
==6841== For counts of detected errors, rerun with: -v
==6841== All heap blocks were freed -- no leaks are possible.