"The buffer might cause memory issues, so you might want to use a cosntructor that overrides it's size and keep in mind to regulary call .flush() after being finished with the current write operation."
Indeed, with the default FileStream buffer size of 4k opening 10000 files would require 40 megabytes only for buffers. That said, calling Flush often doesn't avoid that. Flush only writes the contents of the buffer to disk, it doesn't release the buffer.
Ultimately it all depends on the meaning of "large number". 1000 files? That's a lot but not unreasonable. 1000000 files? Well, that's excessive.
No comments:
Post a Comment