Buffers can in a way be resized, use slice to make smaller, and concat to
make bigger. I doubt slice frees anything, but concat does allocate if it
needs to.

On Thu, Aug 30, 2012 at 2:48 PM, Ben Noordhuis <[email protected]> wrote:

> On Thu, Aug 30, 2012 at 11:12 PM, Seiji Sam Lee <[email protected]>
> wrote:
> > Apologize if this is a old-issue but, why Buffer has its size static?
> >
> > Why don't use realloc to resize its capacity?
>
> Because bad things would happen if the code below was legal:
>
>   var buf = new Buffer(1024);
>   fs.read(fd, buf, buf.length, cb);
>   buf.resize(32);
>
> --
> 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