mirror of https://github.com/nodejs/node.git
Reduce multipart memory footprint
Multipart parts kept the first chunk of data after their headers in memory, even so that was no longer needed.pull/22966/head
parent
b6dda61249
commit
27fcae738a
|
@ -159,6 +159,7 @@ Part.prototype.write = function(chunk) {
|
|||
this.buffer = this.buffer.substr(2);
|
||||
this.bytesReceived = this.bytesReceived + this.buffer.length;
|
||||
this.emit('body', this.buffer);
|
||||
this.buffer = '';
|
||||
return;
|
||||
} else if (offset > 0) {
|
||||
var header = this.buffer.substr(0, offset).split(/: ?/);
|
||||
|
|
|
@ -28,6 +28,7 @@ var server = http.createServer(function(req, res) {
|
|||
parts[name] += chunk;
|
||||
});
|
||||
part.addListener('complete', function(chunk) {
|
||||
assertEquals(0, part.buffer.length);
|
||||
if (parts_reveived == 1) {
|
||||
assertEquals('yes', parts[name]);
|
||||
} else if (parts_reveived == 2) {
|
||||
|
|
Loading…
Reference in New Issue