SC question: max length of string?

Discuss and share scripts and script files...
Post Reply
autocart
Posts: 1384
Joined: 26 Sep 2013 15:22

SC question: max length of string?

Post by autocart »

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

admin
Site Admin
Posts: 66258
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: SC question: max length of string?

Post by admin »

2 GB bytes (that's 1 GB characters) in theory. But a number of factors will reduce it somewhat in reality.

highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: SC question: max length of string?

Post by highend »

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...
Unbenannt.png
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: 66258
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: SC question: max length of string?

Post by admin »

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...

highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: SC question: max length of string?

Post by highend »

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?

Post by autocart »

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...
Unbenannt.png
Sorry, highend, I do not understand this.
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.)

highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: SC question: max length of string?

Post by highend »

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
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?

Post by autocart »

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?

highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: SC question: max length of string?

Post by highend »

It frees the memory when you set it's content to empty.

Code: Select all

    $a = <<<>>>
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
>>>;

    $b = strrepeat($a, 1280000); // 1000 = 1 MB
    $b = "";
    wait 5000;
Use a task manager to look at the memory that XY takes (first 5 seconds).
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?

Post by autocart »

Thanks for the thoughts about the memory and freeing of it, highend.
highend wrote:1. Replace pass with "pass out", "struggle" "can't keep up with", anything like that
Yes, I thought so, but is 128 MB in
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
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.
I don't get it. Did I misunderstand something?
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
Ah, ok.

highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: SC question: max length of string?

Post by highend »

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))
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?

Post by autocart »

Ah, ok, now I got it. Thx again.

Post Reply