Maximum length for a variable

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Jan 16, 2009
45
0
#1
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?
 
Jan 16, 2009
45
0
#3
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.
 
#4
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]
 

rconn

Administrator
Staff member
May 14, 2008
10,289
90
#7
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.
 
#8
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
10,289
90
#9
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.