One integer needs 4 bytes of memory. You allocate 123456789 integers. This are 4 bytes * 123456789 = 493 827 156 bytes. If you calculate 1 MB = 1024 KB and 1 KB = 1024 bytes this will be around 470 MB.

The heap doesn't need to be contiguous. It is provided by the operating system. Gamestudios nexus, which is also saved on the heap, should be contiguous. This helps to avoid memory fragmentation. Memory fragmentation can be a big problem. Your huge array is also allocated in one contiguous block of heap memory. If you have enough free system memory (let's say 1 GB is unused) but this free memory is fragmented in many small blocks (and each block is smaller than 470 MB) then you can't allocate the memory for this array. sys_malloc will return NULL if it couldn't allocate memory on the heap.

Other problems are memory leaks. You have to free the heap memory you used if you don't need it anymore. Maybe before exiting the game or maybe earlier. It depends on how long you will need the data stored in it.

sys_free (nodes);
nodes = NULL;

If you don't free the memory area and you lose/change your nodes-pointer to this memory area you can't use this unfreed area for future memory allocation. You'll need to restart your game to get the memory back.

If your game is closed all allocated memory is freed by Windows. You don't need to free memory before closing the engine, but it's a VERY BAD practice to do this. Maybe you'll never find a memory leak if you don't free memory because you count on Windows help to do this.

Therefore heap memory is not safer to use.