Maximum length for a variable

Jan 16, 2009
45
0
My program to reformat text files reads the entire fire into a variable. Program works fine, but when it hit a file that was 8,773 bytes, TCC gave up the ghost. (Windows reported it; TCC was already dead.)
I have a work around, but am curious what is the maximum size for a variable? Can it be increased to, say 11 KB?
 

rconn

Administrator
Staff member
May 14, 2008
12,557
167
TCC has no limit (other than available memory) for variables or input lines (at least for v17 or later). However, many Windows APIs have maximum size limits for their arguments. Without an example of what you're doing, I can't guess what limit you're running up against.
 
Jan 16, 2009
45
0
Thanks. I dug into it and it was @Xreplace that failed. When I changed all my Xreplace to Rereplace, everything worked. :-)
I'll post a note to the Plugins forum.
 
May 20, 2008
12,171
133
Syracuse, NY, USA
TCC has no limit (other than available memory) for variables or input lines (at least for v17 or later). However, many Windows APIs have maximum size limits for their arguments. Without an example of what you're doing, I can't guess what limit you're running up against.
What limit (apparently ~32K) am I running into when I do this (and TCC disappears)? It would seem there's a limit on what a variable function can return.
Code:
v:\> unset zz

v:\> do i=1 to 9000 ( set zz=%[zz]0 )

v:\> echo %@rereplace[0,1111,%zz]
 
Jan 16, 2009
45
0
Vince, your test was not as fatal as mine - with yours, TCC restarted. With mine, it never came back. ;-)
 

rconn

Administrator
Staff member
May 14, 2008
12,557
167
What limit (apparently ~32K) am I running into when I do this (and TCC disappears)? It would seem there's a limit on what a variable function can return.

What you're running into is the Windows 32K limit on filenames. And @REREPLACE is intended for filename substitution & calls Windows APIs (where the crash is occurring).

@REREPLACE is the wrong solution for this problem. TPIPE is intended for processing files; @REREPLACE is intended for processing filenames.
 
May 20, 2008
12,171
133
Syracuse, NY, USA
What is the size of the pszArguments buffer for a plugin variable or variable function? The "Plugins" help page says 2K but I'm pretty sure it's more than that these days.
 

rconn

Administrator
Staff member
May 14, 2008
12,557
167
What is the size of the pszArguments buffer for a plugin variable or variable function? The "Plugins" help page says 2K but I'm pretty sure it's more than that these days.

32K characters. There's no particular reason why it can't be made bigger, though as I said before any filename bigger than that will blow up Windows.
 

Similar threads