Expose Buffer.poolSize
This commit is contained in:
parent
5da4faf8c7
commit
8b4f1e05f9
@ -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…
x
Reference in New Issue
Block a user