Bug 1739

Summary: The endpoint is not deallocated for UDP sockets
Product: ns-3 Reporter: Juan C. Granda <jcgranda>
Component: internetAssignee: Tommaso Pecorella <tommaso.pecorella>
Status: RESOLVED FIXED    
Severity: major CC: jcgranda, ns-bugs, tommaso.pecorella
Priority: P5    
Version: ns-3.17   
Hardware: All   
OS: All   
Attachments: Proposed patch
new patch

Description Juan C. Granda 2013-07-29 12:24:51 UTC
Created attachment 1650 [details]
Proposed patch

When closing an UDP socket the endpoint is not deallocated (class UdpSocketImpl). A reference to the socket is kept in UdpL4Protocol::m_sockets, so the destructor of UdpSocketImpl is only invoked at the end of the simulation. A solution similar to that used for TCP sockets (class TcpSocketBase) can be used.
Comment 1 Tommaso Pecorella 2013-07-29 16:48:22 UTC
I'm not against it, but not as it is.
1) DeallocateEndPoint must also close IPv6's related endpoint, and
2) it must be triple checked that the proposed change does not cause memory leaks.

Point 2 is becuase I know the TCP and UDP deallocation pain, since endpoints management is all but linear and obvious.

If Valgrind and the tests don't complain, and provided the IPv6 is handled (it's very easy), I'm favourable to this change.
Comment 2 Tommaso Pecorella 2014-01-15 14:52:53 UTC
Created attachment 1763 [details]
new patch

Updated patch to build against ns-3-dev and cope with v6 endpoints (they wasn't there in 3.17).

I'm running Valgrind. If all goes fine, I'll commit this.

T.
Comment 3 Tommaso Pecorella 2014-01-15 17:37:13 UTC
Valgrind is happy.

Pushed in changeset:   10575:16f8ac386faf