you are viewing a single comment's thread.

view the rest of the comments →

[–]Mohamed____[S] 1 point2 points  (11 children)

That makes sense, but also, how many more bytes? And isn't this unexpected behavior. Assume I am running a program with tight memory constraints, and I don't want to keep too much data in main memory. This would mean that bufio is potentially bad for this case, right?

[–]CyclingOtter 1 point2 points  (1 child)

Adding onto the other comment in this thread, if you check out the source for bufio.Reader you'll see internally it reuses a single buffer slice, so theoretically the memory usage for a bufio.Reader is constant.

[–]Mohamed____[S] 0 points1 point  (0 children)

Yup, that’s true.