The mission is simple: NEW (pointer), for every pointer in those arrays of pointers (to records).
You really don't want to do that. I haven't looked exactly at what "new" does internally but, I'm almost certain that it allocates the memory blocks on a heap (likely the system heap.) If that is correct and, it quite likely is, there is additional overhead with every single allocation. Given that addressable space is already tight, that additional overhead gets in the way.
Actually my OS is Windows 7 of 64bit. However, the RAM is 3G only.
How about VirtualAlloc/ex? How may I use it in Free pascal?
The fact that the system only has 3GB is a concern only for performance. The system may be forced to swap things out to accommodate the structures but as long as there is enough space in the swapfile, the allocations should succeed.
As far how to use VirtualAlloc, I attached a very simple sample program to this post that uses VirtualAlloc to allocate a 4K block of memory. Note that it could have allocated 40,000KB exactly the same way just by changing the number of bytes in the call.
The other thing that sample shows is, you can have more than 2GB available in a 32bit program if it is running on a 64bit system. The "trick" is to mark the executable as "large address aware" (I don't know if FPC makes that option available. If it doesn't, get the free CFF explorer from Mark Pistelli (use Google) and mark your executable as "Large address aware". That's done by opening the exe with CFF explorer, click on "File Header" (on the left) then double click on the "Click here" part of the "Characteristics", check the option "App can handle > 2GB address space" then go to "File->save". After that your program will have about 3.7GB of memory but, NOT contiguous. You will still need to break your structure into chunks but, with VirtualAlloc, you can break it into 2 chunks and then calculate the value of the pointers to each individual record, you save those pointers into your array of pointers and you're done. You'll have about 1GB of address space to spare.
The sample program is already marked as being able to handle addresses greater than 2GB. If you look at its process space (Process Hacker would allow you to do that), you'll see that it has a full 4GB of address space. There is one large free chunk of 1.7GB and another of about 2GB. That should be plenty enough for you.
HTH.