LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-03-2008, 06:01 AM   #1
upakul
LQ Newbie
 
Registered: Sep 2008
Posts: 4

Rep: Reputation: 0
Memory leak in socket operations.


Hi all,

I am creating udp sockets to receive packets but i dont call any recv() so the packets must be lying in the udp queue. Now when I close the socket and open a new socket (with reuseaddr sockopt) then it results in memory leaks.

My question is that when closing or shutting down the sockets, isnt the udp queue cleared up? Secondly is there any way to forcefully clear up the memory related to a socket??

Thanks in anticipation!!
 
Old 09-03-2008, 09:26 AM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Unless you have a version of glibc that is bugged (fairly unlikely), then closing the socket will free any system-allocated structures related to the socket. What tool are you using to identify the memory leak? Also, if you don't call recv(), how are you receiving your data?
 
Old 09-03-2008, 10:41 AM   #3
upakul
LQ Newbie
 
Registered: Sep 2008
Posts: 4

Original Poster
Rep: Reputation: 0
Hi Matir,

Thanks for your reply. Actually I just hit at it by chance. When I open a socket, recv() and close ... and so on there is no memory leak. But if I just open a socket, and close it and so on(with reuseaddr) then memory is not freed up. I thought this is not the expected behavior so thought of putting across the query.

I am using /proc/meminfo to check the memory info.

I will do some more experiments and update you.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Inactive memory issue, Freebsd (memory leak?) JasperB *BSD 7 08-12-2008 03:19 AM
Memory Leak adityakrishnan Linux - General 1 03-07-2007 09:39 AM
socket leak in 2.4.21 ? scylla Linux - Networking 0 11-10-2004 04:30 PM
help debugging a socket leak rozeboom Programming 12 08-11-2004 09:19 AM
Memory Leak when using memory debugging C program on SuSE SLES8 babalina Linux - Distributions 0 10-06-2003 09:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration