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 / February 2007

Tip: Looking for answers? Try searching our database.

Help!  Suspected memory leak

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brian - 07 Feb 2007 21:41 GMT
Hello,

I think I've got a memory leak in a C#/.NET service I created.  I hope
someone can help point me in the right direction.

The service runs fine and does what it is supposed to do.  But when I pound
on it, over time, the task manager shows the program 'Services.Exe' (not my
service program) takes up more and more memory.

For example:

After a reboot and before starting my service, Services.Exe shows up as
using 3,384K of memory.

After I start my service, but before I use it, Services.Exe shows up as
using the same amount of memory.

Then I start pounding on it, invoking the service again and again.  After
10,000 calls to the service, Services.Exe has gone from using 3,384K of
memory to using 134,632K of memory.  I know this is a vague question, but
what could my service be doing that would cause such an increase in memory
use in the Windows program Services.Exe?    The memory usage does not decline
when I stop my service nor when I force a garbage collection.

My service creates threads, uses TcpListener, and creates sockets for each
connection so there is ample room for me screwing up.   I just don't know
where to start looking.   I can't tell what Services.Exe is using the memory
for.

I'm still learning .NET/C# so I apologize for my lack of understanding.  If
anyone has any suggestions on where I might start looking, I would appreciate
it greatly.

Thanks!
Signature

Brian

Michael Nemtsev - 09 Feb 2007 11:45 GMT
Hello brian,

Use profiling tools to understand what's goint on
And read this article http://msdn.microsoft.com/msdnmag/issues/07/01/ManagedLeaks/default.aspx?loc=en

---
WBR,  Michael  Nemtsev [C# MVP].  Blog: http://spaces.live.com/laflour
team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

b> I think I've got a memory leak in a C#/.NET service I created.  I
b> hope someone can help point me in the right direction.
b>
b> The service runs fine and does what it is supposed to do.  But when I
b> pound on it, over time, the task manager shows the program
b> 'Services.Exe' (not my service program) takes up more and more
b> memory.
b>
b> For example:
b>
b> After a reboot and before starting my service, Services.Exe shows up
b> as using 3,384K of memory.
b>
b> After I start my service, but before I use it, Services.Exe shows up
b> as using the same amount of memory.
b>
b> Then I start pounding on it, invoking the service again and again.
b> After 10,000 calls to the service, Services.Exe has gone from using
b> 3,384K of memory to using 134,632K of memory.  I know this is a vague
b> question, but what could my service be doing that would cause such an
b> increase in memory use in the Windows program Services.Exe?    The
b> memory usage does not decline when I stop my service nor when I force
b> a garbage collection.
b>
b> My service creates threads, uses TcpListener, and creates sockets for
b> each connection so there is ample room for me screwing up.   I just
b> don't know where to start looking.   I can't tell what Services.Exe
b> is using the memory for.
b>
b> I'm still learning .NET/C# so I apologize for my lack of
b> understanding.  If anyone has any suggestions on where I might start
b> looking, I would appreciate it greatly.
b>
b> Thanks!
b>
Brian - 09 Feb 2007 15:46 GMT
Thank you Michael.
Signature

Brian

> Hello brian,
>
[quoted text clipped - 43 lines]
> b> Thanks!
> b>

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.