Right! great argument, but .... I have done a buffer with a hidden realloc, it born with size zero and realloc when it is needed. There aren't a exlicit realloc method. Would be util for the community?
El viernes, 31 de agosto de 2012 19:23:16 UTC+2, codepilot Account escribió: > > 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]<javascript:> > > wrote: > >> On Thu, Aug 30, 2012 at 11:12 PM, Seiji Sam Lee >> <[email protected]<javascript:>> >> 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]<javascript:> >> To unsubscribe from this group, send email to >> [email protected] <javascript:> >> 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
