istream memory usage

How big does an stream object's buffer get? Is there a limit? In terms of there being multiple instances of the same stream, would each stream read from a file, or add the read data into it's own buffer before returning it?

Basically, do I have to worry about a bunch of istream objects becoming huge?
Depends on the buffer your stream is using:

If you keep writing to std::ostringstream, its std::stringbuf will grow as long as RAM allows.

If you keep writing to std::ofstream, its std::filebuf will be dumping its fixed-size buffer to the file each time it gets full.

If you're just reading, there is nothing to grow, normally.
Last edited on
Thanks.
Last edited on
Topic archived. No new replies allowed.