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,344
149
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
11,400
99
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,344
149
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
11,400
99
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,344
149
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
Thread starter Title Forum Replies Date
Jay Sage TCMD11: Maximum Description Length Support 1
S How to? What's the maximum size of the thread text ? Support 5
D Range command dialog with blank maximum size erases everything Support 5
Steve Pitts Maximum value of Buffer Rows Support 7
R FUNCTION to count NUMBER of files matching a pattern and specific length/not length Support 4
S Take Command crashes for aliases with length > 1015 Support 1
D What is the limit on the compound statement length within ( ) of a FOR-loop? Support 5
J How to? max. practical command line length? Support 3
L Fixed console line length in Take Command 19? Support 3
hrensink Path length limit Support 9
D Parsing an array variable to an array does not work Support 5
sully9 How to? Unexpected %DATE% CMD variable format (vs DATE /T format) in CMDebug Support 1
P Inserting string into a variable. Support 3
vefatica Setting array variable ignores leading spaces (and @execarray doesn't) Support 4
Joe Caverly Set a batch variable (%1 - %n) when TCC is executing a batch file Support 5
R Difference between TCC and CMD: variable names with hyphens Support 4
Joe Caverly Get a variable type Support 2
M How to set Path variable for non-executable file extensions in 4DOS Support 8
rps For loop internal %_for_files variable? Support 2
A How to safely print variable's value without quotes? Support 9
vefatica Array name in a variable? Support 3
nikbackm TCC 20 variable expansion bug Support 6
X How to set %_INIREAD result to variable Support 5
Charles Dye _USBS variable Support 2
BeechComer Debugger: how to set %1 variable? Support 3
Mordachai Variable followed by function constantly failing... Support 5
T Variable indirection for arrays Support 1
Mike Hall Unexpected "Variable loop" in IF condition Support 10
vefatica If there's no PATH variable ... Support 5
D WAD Internal variable _cpu is undefined Support 2
fpefpe How to? Global variable set /v Support 4
I Change value of a variable while debugging Support 3
I "IF" command in a variable does not expand redirection variable name Support 0
J Variable setting regression in tcc17 ? Support 5
Jay Sage WAD Variable _LOGFILE Not Working Support 2
D Fixed Change in behavior of variable expansion between 16 and 17 Support 3
rps Fixed Using last argument variable ! Support 5
Jay Sage Brackets Around Variable Names Support 11
D Internal variable _tctabs within TCExit Support 9
vefatica WAD Nested variable expansion in PDIR's @function[*]? Support 13
J Set environment variable from stdout of command Support 3
nickles Passing a variable to a command w/o adding it to the local environment Support 7
nickles WAD Variable name gets changed within FOR loop Support 2
nikbackm FUNCTION with variable number of arguments Support 17
rfaquino WAD Apparently a bug when expanding environment variable %ProgramFiles(x86) Support 2
S WAD %_do_errors does not report errors when loop control variable type is not directory entry Support 1
B WAD environment variable in TCC.exe Support 2
Frank watch an array variable in ide/bdebugger Support 2
vefatica Conditional expressions in a variable? Support 2
CWBillow UNSET a Variable Support 7

Similar threads