Browse Source

Expose Buffer.poolSize

v0.7.4-release
Ryan Dahl 14 years ago
parent
commit
8b4f1e05f9
  1. 19
      lib/buffer.js

19
lib/buffer.js

@ -80,15 +80,6 @@ SlowBuffer.prototype.write = function (string, offset, encoding) {
// Buffer
var POOLSIZE = 8*1024;
var pool;
function allocPool () {
pool = new SlowBuffer(POOLSIZE);
pool.used = 0;
}
function Buffer (subject, encoding, offset) {
if (!(this instanceof Buffer)) {
@ -127,7 +118,7 @@ function Buffer (subject, encoding, offset) {
this.length = length;
if (length > POOLSIZE) {
if (length > Buffer.poolSize) {
// Big buffer, just alloc one.
var parent = new SlowBuffer(subject, encoding);
Object.defineProperty(this, "parent", { enumerable: false,
@ -167,6 +158,14 @@ function Buffer (subject, encoding, offset) {
exports.Buffer = Buffer;
Buffer.poolSize = 8*1024;
var pool;
function allocPool () {
pool = new SlowBuffer(Buffer.poolSize);
pool.used = 0;
}
// Static methods
Buffer.isBuffer = function isBuffer(b) {

Loading…
Cancel
Save