[PATCH] D39444: [Support] Make the default chunk size of raw_fd_ostream to 1 GiB.

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 30 19:32:02 PDT 2017


zturner added inline comments.


================
Comment at: llvm/lib/Support/raw_ostream.cpp:589-590
   // the latter has a size limit (66000 bytes or less, depending on heap usage).
-  bool ShouldWriteInChunks = !!::_isatty(FD) && !RunningWindows8OrGreater();
+  if (!!::_isatty(FD) && !RunningWindows8OrGreater())
+    MaxWriteSize = 32767;
 #endif
----------------
The comment here doesn't make sense to me.  It says "Writing a large size of output **to Windows console**", but then the code only limits the write size if it's **not** a TTY.  Isn't this check inverted?  It should be setting the max write size if it **is** a tty.

Furthermore, the documentation for `WriteConsole` doesn't say anything about Windows 8, it just says the buffer is at most 64k.  It even says that the buffer could be smaller, but how much smaller depends on heap usage.  So for all we know, it might not even be 32K.

Granted, you're only changing the non-Windows code path, but this just looks wrong to me, in case you're interested in fixing it.


https://reviews.llvm.org/D39444





More information about the llvm-commits mailing list