Maximum String Length?

BlitzMax Forums/BlitzMax Beginners Area/Maximum String Length?

Gabriel(Posted 2008) [#1]
Is there a maximum string length? You would think this would have cropped up before but the only thread I could find related to Blitz3D, and since Blitzmax treats Strings as objects, it's possible that the situation is different now.

In Blitz3D, apparently there was no (practical) limit on strings. They could be up to 2GB or something. I'm guessing this is probably the same with BMax, but I would like to be sure before I code something which depends on them being very long.


ImaginaryHuman(Posted 2008) [#2]
I think the string length is an integer, although it's a signed integer, so probably up to 2 gigs.

Try creating one that long.


TomToad(Posted 2008) [#3]
Well, i got a string 2^28 characters long, but when I tried for 2^29, the program crashed. so the actual length is somewhere between 256 megacharacters and 512 megacharacters. If I'm not mistaken, each character is stored as 2 characters, so the actual memory usage would be between 512MB and 1GB.

just did some more testing, seems the maximum changes every time I run the program. My computer has 2GB of memory and much of that is being used by Vista. So maybe I'm simply running out of space rather than there being a limit on string size. BTW, BMax isn't throwing any errors, the program just simply quits working.


Gabriel(Posted 2008) [#4]
Thanks guys, looks like there is plenty enough scope that I don't need to worry.