Make buffers readonly #628

Closed
piscisaureus opened this Issue Feb 4, 2011 · 5 comments

Comments

Projects
None yet
5 participants
Member

piscisaureus commented Feb 4, 2011

Possible use case: buffers that are being pumped into a socket or file (or queued to be) should be immutable, because modifying them in the middle of an i/o operation leads to unexpected results.

tj commented Feb 4, 2011

definitely not all of them, maybe a flag

ry commented Feb 4, 2011

Need aid from V8 on this to allow us to make

https://github.com/ry/node/blob/c10caca34cb0b11740e013e09c38d125591d4de3/deps/v8/include/v8.h#L1658-1672

read-only temporarily.

@piscisaureus is your basic concern that someone could queue a buffer to be written to a file asynchronously then immediately operate on the buffer before it has time to be written?

Since this hasn't been addressed in 2 years, is this still an issue?

Owner

bnoordhuis commented Nov 14, 2012

is your basic concern that someone could queue a buffer to be written to a file asynchronously then immediately operate on the buffer before it has time to be written?

Yes.

Since this hasn't been addressed in 2 years, is this still an issue?

No. It's a feature that in all likelihood cannot be implemented without undue overhead. Let's close it.

bnoordhuis closed this Nov 14, 2012

Member

piscisaureus commented Nov 14, 2012

Rightly so. It was a long time ago I last took a stab at this but in the end the fact that multiple buffer objects can refer to the same memory location spoils it bigtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment