Bug array size in x64

Post bugreports for the Windows version here
User_Russian
Addict
Addict
Posts: 1215
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Bug array size in x64

Post by User_Russian »

I create an array of size 5 GB, and compile in PB 5.73 x64.

Code: Select all

Dim x.a(5*1024*1024*1024)
Debug ArraySize(x())
But the array size is 1 GB.

This code reports an error.

Code: Select all

Dim x.a(3*1024*1024*1024)
Debug ArraySize(x())
Why array indexing used Long rather than Integer?
User avatar
Bisonte
Addict
Addict
Posts: 1163
Joined: Tue Oct 09, 2007 2:15 am

Re: Bug array size in x64

Post by Bisonte »

Nice catch. (Confirmed on PB5.73x64 and Win10 Pro x64)

I tried it, and the maximal size is : 2147483646 so maxLong - 1.

And the memory of the used pc is about 64GB, so this should not be the problem ;)
PureBasic 5.73 LTS (Windows x86/x64) | Windows10 Pro x64 | Asus TUF X570 Gaming Plus | R9 5900X | 64GB RAM | GeForce RTX 3080 TI iChill X4 | HAF XF Evo | build by vannicom​​
English is not my native language... (I often use DeepL to translate my texts.)
ricardo_sdl
User
User
Posts: 57
Joined: Sat Sep 21, 2019 4:24 pm

Re: Bug array size in x64

Post by ricardo_sdl »

Apparently if pass the size as a constant it will be interpreted as long(range -2147483648 to +2147483647), but if declare the size as a Quad(range -9223372036854775808 to +9223372036854775807) it will accept the array size:

Code: Select all

Size.q = 5 * 1024 * 1024 * 1024

Dim Foos.a(Size)
Debug ArraySize(Foos())
The size reported was 5368709120 on PureBasic 5.73 LTS (Windows - x64).
You can check my games at:
https://ricardo-sdl.itch.io/
Post Reply