I did some experimenting on this and it seems a basic 32-Bit PB app can allocate about 1,376,780,254 bytes of RAM. But not all at once. The only way I could come even close to that number was in incremental steps by allocating increasingly smaller blobs. The basic code block to create a single block looks like this. I used a new blob variable for each iteration.
ls_spaces = space( ll_spaces )
lblb_test = Blob(ls_spaces, EncodingUTF8!)
ls_spaces = ''
I used UTF8 because in case of spaces this will result in a blob exactly the size of ll_spaces in bytes. ANSI would probably work the same. I started out with one below the supposed maximum supported by Space (2147483646) but that would always error out with "Not enough memory to execute..."
Then I halved the amount with each step.
1073741823: "Not enough memory to execute..."
536870911: "Not enough memory to execute..."
268435455: NO error message so the string was created but it would just silently crash at the line creating the blob from the string.
134217727: This finally worked. But only three times, then I had to go down by half again. In the end it took the following to approach the apparent memory limit:
3x134217727
9x67108863
8x33554431
1x16777215
13x8388607
1x4194303
3x1048575
=~1.3GB RAM. After each allocation crashed I went down by half. No idea why at one point the 16MB allocation failed while 13 8MB blobs could still be created without issue. I mean there's obviously overhead from creating the string variable but it shouldn't be that much? I dunno.
I also tried compiling to 64bit and 64Bit PB Apps handle memory allocation a lot better but it STILL won't allow the supposed maximum for the Space function. The actual maximum seems to be 1053140931, because at 1053140932 it starts to give you the "Not enough memory to execute..." RTE.
In 64bit, the actually available RAM seems to be the limit, I could create 16 ~1GB blobs with no issues. Doing any concatenation etc. with strings this large still just silently crashes the app, though.
Andreas.