On Tue, May 15, 2012 at 11:35 PM, Ryan Cole <[email protected]> wrote:
> I'm writing a module that parses data as it comes in from a tcp socket. When
> reading out data from a Buffer, is it better to stick to the slice method
> because of the fact that it uses the same heap memory as the initial Buffer?

Yes.

> Do the read methods do this, as well? I've just assumed that the read
> methods do not use that same Buffer memory. I'd think that if it were
> possible to stick to just using slice, my module would use less memory
> during this data parsing phase. Is this accurate?

I'm not sure what read methods you mean. socket.read()?
buf.readUInt8() and friends?

-- 
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