Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

System Testing through Perfomance Monitor Tool: Memory Problem

Status
Not open for further replies.

FurqanAhmed

Programmer
Oct 1, 2001
87
PK
Hi All

i have developed a Client/Server Chatting appliation.
in which i developed a Chatserver which is run as window service at centrize location and client app which is a window form that just connect to the chat server and start chatting.

when the client connect to the server, server creates a instance of client and open a thread for it to handle seperately as the server normally do in chat application.

as the chatserver will keep ruuning all the time, so i have to test the server... i am testing it by using perfomance monitoring tool provided by window.

so i am testing my server through following parameters.

Processore Time.
Thread Count

the reading of above paramter is fine.

Hanlde Count

when the thread creates the hanlde count increase but it doesnot decrease when the thread stopped.

Private Bytes
Virtual Bytes.

Private Bytes and Virtual Memory also increase when the client connect to the server but it does not decrease when it disconnect to the server, although i am properly deleting the client.

Problem:
1-
i just want to know how can i check the memory status of my applcation... i just want to know if the client connect to the server, abviously it would take the some memory.. but i should be release when it dissconnect.

2-
if the thread stopped why handle count is not decressing and if it should be decreased then how can i free the handle of a thread.

i would be thankfull if someone solve my problem.

Thank You,
Best Regards.


YEH GHAZI YEH TERAY PUR-ASRAR BANDAY
 
Are you using asynchronous sockets? If you are, the CLR will "pin" the memory used by your receive & send buffers so that the network driver can write directly to the memory. The problem happens when the garbage collector sees a pinned object -- it stops it's collection right there. Over time your memory usage will increase as newly created pinned objects go higher and higher in memory.

The solution would be to pre-allocate your buffers -- either pick a reasonably large size as a max, or allocate them in large chunks (of 500 or so) to minimize the fragmentation.

Chip H.


____________________________________________________________________
Donate to Katrina relief:
If you want to get the best response to a question, please read FAQ222-2244 first
 
i am just using TcpListner and TcpClient

when TcpClient give request to the server to conenct, TcpListner accept it in Socket's class object.

and communcation is done through following

NetworkStream netStream
StreamWriter writer
StreamReader reader

when i want to send the data, i just write

string str = "Hello World";

writer.WriteLine(str);
writer.Flush() ;

and when i want to recve the data i recves as

str = reader.ReadLine();

plz give me the solution how can i resolve the problem by working as mentioned.


Thank You,
Best Regards


YEH GHAZI YEH TERAY PUR-ASRAR BANDAY
 
How long are you waiting for the memory usage to go down? Don't forget that C# is a garbage-collected language, and a GC cycle might not run for several minutes on a lightly-loaded system.

Chip H.


____________________________________________________________________
Donate to Katrina relief:
If you want to get the best response to a question, please read FAQ222-2244 first
 

Even if i forcely collect the garbage at every 2 or 3 seondes the memory does not descrease.

Adnan Anwar
Best Regards

YEH GHAZI YEH TERAY PUR-ASRAR BANDAY
 
Then I would step through your code watching for the memory to go up. Step further to see when that object is being freed (or not!).

Chip H.


____________________________________________________________________
Donate to Katrina relief:
If you want to get the best response to a question, please read FAQ222-2244 first
 
You don't mention anything about closing the socket before tying off the thread. Are you doing that?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top