It's none business of buffer, the server didn't use buffer.
and if I change "this.end()" to "this.destroy" in server.js, the memory 
usage will be stable, no more then 100MB.
 
On Thursday, June 7, 2012 5:18:34 PM UTC+8, ajlopez wrote:

> No help nor solution, but maybe related:
> socket.write keeping reference to buffer?
>
> https://groups.google.com/group/nodejs/browse_thread/thread/46db7a4dd63bcbe9
>  
>
> On Thu, Jun 7, 2012 at 4:42 AM, darcy <[email protected]> wrote:
>
>> I've posted an issue on github of node:
>> *https://github.com/joyent/node/issues/3368#issuecomment-6164666*<https://github.com/joyent/node/issues/3368#issuecomment-6164666>
>>  
>> If the client "destroy()" the socket after write something to server, and 
>> the server "end()" the socket when received the data, the mem usage of 
>> server will increase continuously. 
>> the codes:
>>  
>> server.js: 
>> var net = require('net');
>> var s = net.createServer(function(c) {
>>     c.on('data', function(data){
>>         this.forleak = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
>>         this.end();
>>     });
>> }).listen(29999);
>>
>>  
>> client.js:
>> var net = require('net');
>> setInterval(function(){
>>     var a=1000;
>>     while(--a){
>>         var c = net.connect(29999);
>>         c.on('connect', function(){
>>             this.write("dfadafdaf", 'utf8', (function(){
>>                 this.destroy();
>>             }).bind(this));
>>         });
>>         c.on('error', function(e){
>>             console.log("error"+e);
>>         });
>>     }
>> }, 1000);
>>
>>  
>> and before test , you should change these system params to ensure enough 
>> short connections:
>> echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle
>> echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse
>> echo 1 > /proc/sys/net/ipv4/tcp_timestamps
>> I've tested on centos and ubuntu by v0.6.18, and both the server.js use 
>> more and more memory, the longest test I've run is 7 hours, the memory 
>> usage is:
>> RES: 1.4g
>> VIRT: 2060m
>>  
>> but *bnoordhuis* <https://github.com/bnoordhuis> said he can't reproduce.
>>  
>> can any one help test on your envirouments?
>> thanks very much!
>>  
>> -- 
>> Job Board: http://jobs.nodejs.org/
>> Posting guidelines: 
>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> You received this message because you are subscribed to the Google
>> Groups "nodejs" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>
>
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to