Bugzilla – Bug 1875
Memory leak: LinuxSocketImpl:Send()/Sendto() with DCE Cradle
Last modified: 2014-04-15 09:42:00 EDT
Reported by Siddharth Gangadhar (following email). When we simulate high speed networks that transfer a large amount of bulk data over the network (400 Mbps for a length of 1200 seconds), we noticed that the RAM consumption for the process rises exponentially and reaches ~40-50Gig for the simulation. Upon further investigation, we noticed that the linux socket does not seem to delete the temp buffer that it created in the function LinuxSocketImpl::Send (Ptr<Packet> p, uint32_t flags) in the form of buf and a delete[] buf would be needed after the write process to m_kernsock. A similar delete[] buf statement would also need to be added to int LinuxSocketImpl::SendTo (Ptr<Packet> p, uint32_t flags, const Address &address) After the above change, we noticed that the RAM usage dropped to 200-300 MB thus validating our change. The diff is summarized below: diff -r 73285fae30f9 model/linux/linux-socket-impl.cc --- a/model/linux/linux-socket-impl.cc Sun Nov 10 00:37:22 2013 +0900 +++ b/model/linux/linux-socket-impl.cc Fri Mar 07 11:09:31 2014 -0600 @@ -354,7 +354,7 @@ { NS_LOG_INFO ("send returns " << ret << " errno " << Current ()->err); } - + delete[] buf; LeaveFakeTask (pid); return ret; } @@ -399,6 +399,7 @@ { NS_LOG_INFO ("sendmsg returns " << ret << " errno " << Current ()->err); } + delete[] buf; LeaveFakeTask (pid); return ret; }
fixed. with the following changeset. author Siddharth Gangadhar <siddharth@ittc.ku.edu> Sat, 08 Mar 2014 10:47:18 +0900 (2 minutes ago) changeset 584 feee7d4dbb7a parent 583 42c40c4370fd