Perl seems to have limits but not sure why. I don't have unlimited memory in my computers
The second statement is true for everyone. And that rather shows the error in the first. You have assumed that Perl has limits when in fact all your demonstration shows is that your computer (and/or operating system) has limits. You can't put 10 litres of anything in a 1 litre bottle.
But it seems I have more than 800 MB of free memory, yet it won't allow me to create a 1 GB string.
You have 1767792kB of free memory. Even a cursory inspection shows that this will allow the allocation of 800MB x 2 but not 1GB x 2. I therefore posit that your unshown code actually uses twice the amount of RAM that you think it should. Try adding 400MB of swap space and be amazed that your program will now run with a 1GB string instead.
Well, anyway, I just wanted to know what's a safe size for a string. So, it seems that if I create a program that works with 1 GB strings, it will run on most modern machines. But if I write a program that relies on creating and working with 2GB or 4GB strings, then that might fail on some systems. I guess, the bigger the string, the fewer computers will be able to handle it.
That isn't how publicly distributed programs are written. You cannot assume anything about the platform on which your code will be run, so don't even try.
🦛
In reply to Re^3: maximum length of scalar in theory
by hippo
in thread maximum length of scalar in theory
by harangzsolt33
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |