The MASM Forum

General => The Workshop => Topic started by: jj2007 on October 05, 2015, 08:04:01 PM

Title: Undocumented StdOut limit for console output
Post by: jj2007 on October 05, 2015, 08:04:01 PM
Inspired by the thread on vkdebug PrintString (http://masm32.com/board/index.php?topic=4668.0), I investigated about the practical limits of printing to the console.

StdOut fails with error 8, not enough memory, when the string exceeds 62600 bytes on Windows 7-64.
On Windows XP, the limit is 53200 bytes, on Win 8.1 it seems much higher (>2MB).

Accordingly, I have increased the buffer size for the deb macro. Example:

include \masm32\MasmBasic\MasmBasic.inc      ; download (http://masm32.com/board/index.php?topic=94.0)
  Init
  Let esi=FileRead$("\Masm32\include\Windows.inc")
  deb 4, "Windows.inc", $esi:999999   ; ask for a Million bytes
  Print "OK"
  Exit
EndOfCode


During assembly, ## line 4: deb display limited to 62600 bytes (XP limit is 53200) ## will be shown, indicating that deb cut off at the amount of bytes that is safe for Win7.

P.S.: By default, $esi (without :bytes) would display 800 bytes.
Title: Re: Undocumented StdOut limit for console output
Post by: hutch-- on October 05, 2015, 08:49:12 PM
The trick with StdOut is to stream it out, not dump it in one block. Feed it out at about 1k each block and it will stream forever without delays.