Does anyone know of a library to provide huge arrays?
Even for a very large array, you probably don't need a library.
Presuming you're doing this under Windows. The maximum size will be 16TB - 64K (it doesn't quite make it to 16TB), that's quite a bit less than high(qword) which, at least in theory, is the maximum amount of memory VirtualAllocEx will allow you to allocate (I seriously doubt it will allow something close to that.)
Using VirtualAllocEx, you could allocate (MEM_COMMIT) a very large array (might even allow greater than 1TB but, I've never tried it), the best part is that since Windows is demand paged, the array is _automatically_ sparse, IOW, if all the elements are within 4K, then there will at most be 2 pages of memory used even if the amount committed is 1 TB (or greater) and it is the last 2 pages that are used.
Succinctly, in 64 bit, the O/S already gives you huge arrays. How huge ?... that part I don't know but, really big!. I suggest you do a little trial and error to find out.
Also, as Nicole implied, if you gave a more detailed description of what you're trying to do then a more "precise" suggestion might be possible.
Lastly, that doesn't work using heaps because heap blocks are managed a different way.
HTH.