Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Distributed Applications / July 2004

Tip: Looking for answers? Try searching our database.

Socket Memory Leak

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jim P. - 25 Feb 2004 06:24 GMT
I've noticed others have had this same problem, but no answers appear to be
surfacing.  So here I go again.

Using asynchronous callbacks: I am receiving incoming socket connections,
receiving the network stream, and closing the socket.

Problem is that each socket connection adds 4k of memory usage that never
clears away.  I close the socket and null out my StateObject to allow for
garbage collection.  So why aren't the resources being released?  Is the
origional socket connection not being closed when the
StateObject.Socket.Close() is called?

Thanks again,
Jim
Eric Cadwell - 25 Feb 2004 16:38 GMT
Are you closing the NetworkStream object?  Once you call GetStream the
socket is owned by the stream.

-Eric
Jim P. - 25 Feb 2004 17:45 GMT
Yup, I'm closeing the NetworkStream.  This is probubly overkill, but here is
the Closing code.

// Close networkStream & Socket and NULL out resources
SocketObject.networkStream.Close();
SocketObject.socket.Shutdown(SocketShutdown.Receive);
SocketObject.socket.Close();

SocketObject.networkStream = null;
SocketObject.socket = null;
SocketObject = null;

> Are you closing the NetworkStream object?  Once you call GetStream the
> socket is owned by the stream.
>
> -Eric
DotNetJunkies User - 27 Jul 2004 19:18 GMT
Jim,

I habe the same problem with a 4k memory leak each time I siphon a request off of the Listener queue using Socket.Accept.  I'm shutting down and closing the socket, but with the same results.

Did you find resolution on this?

-Anthony

Anthony Iasso
Oberon Associates

---

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.