Not logged in. · Lost password · Register
Forum: agsXMPP SDK Support RSS
Avatar
alexan #1
Member since Aug 2006 · 7 posts
Group memberships: Members
Show profile · Link to this post
Subject: Memory usage in windows task manager keep growing on server application
Hi Alex,

I have some issue about the server application: i already make code for routing client rooster, message or presence to another client which store in database, and i check my windows task manager, everytime the client connect to server application, the server memory usage is growing(that is fine), but the problem is, when i close the client application, the memory usage of the server application is still growing or not coming down, so i afraid that my memory resource will be not enough.

Please give some advice about this,
thanks.
This post was edited on 2006-09-12, 07:19 by alexan.
Avatar
Jabberer #2
Member since Feb 2006 · 249 posts
Group memberships: Members
Show profile · Link to this post
Look in the .NET documentation how to clean up your objects correctly. Also do some research about the .NET garbage collector. If you close a connection and the garbage collector does not run its normal that the memory is not coming down.
You could also try to write a test application which opens 1000 connections or more.
Software Developer
AG-Software
Avatar
alexan #3
Member since Aug 2006 · 7 posts
Group memberships: Members
Show profile · Link to this post
thanks for your reply,

i add GC.Collect() code and when i make about 20 and more connection, the memory is down , maybe because of the garbage collector behavior that not immediately free the memory resource,

thanks again :)
Avatar
Alex #4
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
hi alexan,

exactly, which makes also sense for a server application.
dotNet knows that your application has requested this amount of memory and assumes you probably need the same amount soon again.
You can run the GC collector manual from time to time to cleanup resources, but i would not run it after every session shutdown.

Alex
Alexander Gnauck
AG-Software
Avatar
alexan #5
Member since Aug 2006 · 7 posts
Group memberships: Members
Show profile · Link to this post
hi alex,

ic...  thanks alex
Avatar
mayprog #6
Member since Mar 2006 · 61 posts
Group memberships: Members
Show profile · Link to this post
I don't know if i can help but i had many memory problems also and from what i learned:
- be very carefull with EventHandlers and try to use some Weak References if possible. Event Handlers is my biggest problem with memory consumption as they keep my objects alive althought i don't use them any more.
- Also be very carefull when using unmanaged resources (Connections). You must always close and dispose them!
- I have found  a very helpfull tool .Net Memory Profiler which really helps (i don't want to advertize anything here, i have nothing to do with this company but really it helped me).


If you have any more tips please share them with me too!

Thanks!
Avatar
Jabberer #7
Member since Feb 2006 · 249 posts
Group memberships: Members
Show profile · Link to this post
a good free tool called CLR-Profiler is available here from Microsoft:
http://www.microsoft.com/downloads/details.a…?familyid=A…
It also ships with fill source code.
Software Developer
AG-Software
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP SDK Support RSS