Skip to content

Commit 8b4f1e0

Browse files
committed
Expose Buffer.poolSize
1 parent 5da4faf commit 8b4f1e0

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

lib/buffer.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,6 @@ SlowBuffer.prototype.write = function (string, offset, encoding) {
8080

8181

8282
// Buffer
83-
var POOLSIZE = 8*1024;
84-
var pool;
85-
86-
87-
function allocPool () {
88-
pool = new SlowBuffer(POOLSIZE);
89-
pool.used = 0;
90-
}
91-
9283

9384
function Buffer (subject, encoding, offset) {
9485
if (!(this instanceof Buffer)) {
@@ -127,7 +118,7 @@ function Buffer (subject, encoding, offset) {
127118

128119
this.length = length;
129120

130-
if (length > POOLSIZE) {
121+
if (length > Buffer.poolSize) {
131122
// Big buffer, just alloc one.
132123
var parent = new SlowBuffer(subject, encoding);
133124
Object.defineProperty(this, "parent", { enumerable: false,
@@ -167,6 +158,14 @@ function Buffer (subject, encoding, offset) {
167158

168159
exports.Buffer = Buffer;
169160

161+
Buffer.poolSize = 8*1024;
162+
var pool;
163+
164+
function allocPool () {
165+
pool = new SlowBuffer(Buffer.poolSize);
166+
pool.used = 0;
167+
}
168+
170169

171170
// Static methods
172171
Buffer.isBuffer = function isBuffer(b) {

0 commit comments

Comments
 (0)