Bug 1739 - The endpoint is not deallocated for UDP sockets
The endpoint is not deallocated for UDP sockets
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: internet
ns-3.17
All All
: P5 major
Assigned To: Tommaso Pecorella
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-29 12:24 EDT by Juan C. Granda
Modified: 2014-01-15 17:37 EST (History)
3 users (show)

See Also:


Attachments
Proposed patch (1.31 KB, application/octet-stream)
2013-07-29 12:24 EDT, Juan C. Granda
Details
new patch (2.17 KB, patch)
2014-01-15 14:52 EST, Tommaso Pecorella
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Juan C. Granda 2013-07-29 12:24:51 EDT
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 EDT
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 EST
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 EST
Valgrind is happy.

Pushed in changeset:   10575:16f8ac386faf