Hi all, Hi Don,
Simple question, but I could not find the answer neither in the help file nor here with the search function in the forum:
In XY what is the max length allowed for a string (especially in scripting but if it differs in other places it would also be good to know).
E.g. I wonder about it when retrieving / passing a string of many file paths. How many file paths can I max include (in average worst case)? What is the limit?
Thx and regards
SC question: max length of string?
-
autocart
- Posts: 1384
- Joined: 26 Sep 2013 15:22
SC question: max length of string?
[AHK] redirecting Windows Explorer to XY, [XYS] Mini Tree with open tabs (cur loc expanded, tab folders highlighted), [AHK] customInlineRenameKeys, [AHK] clipboardHelper_and_XYEscToList
-
admin
- Site Admin
- Posts: 66257
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: SC question: max length of string?
2 GB bytes (that's 1 GB characters) in theory. But a number of factors will reduce it somewhat in reality.
FAQ | XY News RSS | XY X
-
highend
- Posts: 14940
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: SC question: max length of string?
I can write 128MB of text data (the string "a") that is hold in a variable, but XY passes already
on 256 MB (see screenshot).
x64 OS, 16GB RAM, 12GB available...
on 256 MB (see screenshot).
x64 OS, 16GB RAM, 12GB available...
To see the attached files, you need to log into the forum.
One of my scripts helped you out? Please donate via Paypal
-
admin
- Site Admin
- Posts: 66257
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: SC question: max length of string?
I think the 1 GB characters is only valid if this is the only string around.
But XY's source code has a couple of other strings busy while you are scripting...
FAQ | XY News RSS | XY X
-
highend
- Posts: 14940
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: SC question: max length of string?
No problem, that's still about half a million 255 char long paths...
One of my scripts helped you out? Please donate via Paypal
-
autocart
- Posts: 1384
- Joined: 26 Sep 2013 15:22
Re: SC question: max length of string?
Sorry, highend, I do not understand this.highend wrote:I can write 128MB of text data (the string "a") that is hold in a variable, but XY passes already
on 256 MB (see screenshot).
x64 OS, 16GB RAM, 12GB available...
1) Why do you say "XY passes already" when 256 MB is more than 128 MB?
2) What does the screenshot say regarding the length of the string at the time of the error?
I cannot see it. It says "Not enough string memory" ("Nicht genügend Zeichenfolgenspeicher") but I cannot see how much string memory used by the string causing the error. Or do I overlook something? (Sorry for being doo dumb.)
[AHK] redirecting Windows Explorer to XY, [XYS] Mini Tree with open tabs (cur loc expanded, tab folders highlighted), [AHK] customInlineRenameKeys, [AHK] clipboardHelper_and_XYEscToList
-
highend
- Posts: 14940
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: SC question: max length of string?
1. Replace pass with "pass out", "struggle" "can't keep up with", anything like that
2. I wanted to show Don a screenshot of the message. I didn't say that it would show the length of the variable / data
2. I wanted to show Don a screenshot of the message. I didn't say that it would show the length of the variable / data
One of my scripts helped you out? Please donate via Paypal
-
autocart
- Posts: 1384
- Joined: 26 Sep 2013 15:22
Re: SC question: max length of string?
Thinking of which...
Does XY (scripting that is) automatically free memory from string variables after they are not used anymore?
-) If yes what determines whether is is still used or not (and therefore the memory available again).
-) If no, can I do so manually and if so then how?
Does XY (scripting that is) automatically free memory from string variables after they are not used anymore?
-) If yes what determines whether is is still used or not (and therefore the memory available again).
-) If no, can I do so manually and if so then how?
[AHK] redirecting Windows Explorer to XY, [XYS] Mini Tree with open tabs (cur loc expanded, tab folders highlighted), [AHK] customInlineRenameKeys, [AHK] clipboardHelper_and_XYEscToList
-
highend
- Posts: 14940
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: SC question: max length of string?
It frees the memory when you set it's content to empty.
Use a task manager to look at the memory that XY takes (first 5 seconds).
Code: Select all
$a = <<<>>>
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
>>>;
$b = strrepeat($a, 1280000); // 1000 = 1 MB
$b = "";
wait 5000;One of my scripts helped you out? Please donate via Paypal
-
autocart
- Posts: 1384
- Joined: 26 Sep 2013 15:22
Re: SC question: max length of string?
Thanks for the thoughts about the memory and freeing of it, highend.
I don't get it. Did I misunderstand something?
Yes, I thought so, but is 128 MB inhighend wrote:1. Replace pass with "pass out", "struggle" "can't keep up with", anything like that
not a mistake? Why would XY "already" pass out on 256 MB vs. 128 MB text data storeable? If the 128 are correct then it would not reach beyond 128 and never reach 256.highend wrote:I can write 128MB of text data (the string "a") that is hold in a variable, but XY passes already
on 256 MB
I don't get it. Did I misunderstand something?
Ah, ok.highend wrote:2. I wanted to show Don a screenshot of the message. I didn't say that it would show the length of the variable / data
[AHK] redirecting Windows Explorer to XY, [XYS] Mini Tree with open tabs (cur loc expanded, tab folders highlighted), [AHK] customInlineRenameKeys, [AHK] clipboardHelper_and_XYEscToList
-
highend
- Posts: 14940
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: SC question: max length of string?
Eh?
128 MB of text in a variable = working on my system
256 MB = XY spits out the error message
Anything in between = Not tested (and it doesn't matter for me because it isn't a fixed value (as Don explained))
128 MB of text in a variable = working on my system
256 MB = XY spits out the error message
Anything in between = Not tested (and it doesn't matter for me because it isn't a fixed value (as Don explained))
One of my scripts helped you out? Please donate via Paypal
-
autocart
- Posts: 1384
- Joined: 26 Sep 2013 15:22
Re: SC question: max length of string?
Ah, ok, now I got it. Thx again.
[AHK] redirecting Windows Explorer to XY, [XYS] Mini Tree with open tabs (cur loc expanded, tab folders highlighted), [AHK] customInlineRenameKeys, [AHK] clipboardHelper_and_XYEscToList
XYplorer Beta Club