This project has moved. For the latest updates, please go here.

Huge Memory Usages on Windows 7 x64

May 31, 2010 at 5:59 PM

Hello,

I'm developing a solution where I try externalize the Socket thing away,

I started implementing the " transport layer " using the Nito.Async.Sockets, I did few test then my mouse was starting to move slowly :)

Checked the memory usage and it had 1,7 G of ram with one connection and few key presses after the telnet. Here is what I did:

1. console app

2. AsynchThread + listen( localhost:8080 )

3. telnet localhost 8080 ( memory is ok, no problems, a normal 20 or so of megs )

4. start typing some letters in the telnet session, then ram consumption goes nuts instantly and no "PacketArrived" event emitted 

 

To compare this with the things in the sources, I have verified the included test - "SimpleServer" made in Winforms,

1. start the app

2. click listen for the port that is in the edit box - 7750

3. open a browser (chrome) and then type localhost:7750

4. check the ram and see that with 2 connections doing nothing the rams goes to 512 Megs of ram

5. repeat 1 and 2 then do a telnet, after a connect type some letters - the ram goes nuts again to 1,7G ...

 

Is this normal ? The debug or release mode have the same effect

If you need more info on this let me know,

 

BTW, nice API to get started quickly, but there is some behavior that is a bit weird ...

Coordinator
Jun 1, 2010 at 2:19 PM

The "Simple" socket classes do not use a Telnet-compatible or HTTP-compatible protocol. They use a 4-byte integer prefix packeting scheme.

The behavior you're seeing is perfectly normal. Telnet will send what you type across the network, but the Simple servers will interpret the first couple of characters as a binary number representing the packet size. Similarly, HTTP will start out by sending HTTP headers as plain text, which are interpreted as a binary packet size. The "packet size" read would be very large, and so the server would allocate a large incoming buffer.

       -Steve